Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 298916 Details for
Bug 438676
reduce false NFS cache invalidations due to overlapping write and getattr calls
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
rhel5 patch 1
nfs-mtime-sem.patch (text/plain), 4.05 KB, created by
Jeff Layton
on 2008-03-24 18:35:00 UTC
(
hide
)
Description:
rhel5 patch 1
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-03-24 18:35:00 UTC
Size:
4.05 KB
patch
obsolete
>diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c >index 3ac2e7f..a7efc96 100644 >--- a/fs/nfs/direct.c >+++ b/fs/nfs/direct.c >@@ -393,6 +393,7 @@ static void nfs_direct_free_writedata(struct nfs_direct_req *dreq) > static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) > { > struct inode *inode = dreq->inode; >+ struct nfs_inode *nfsi = NFS_I(inode); > struct list_head *p; > struct nfs_write_data *data; > >@@ -425,6 +426,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) > /* > * We're called via an RPC callback, so BKL is already held. > */ >+ down_read(&nfsi->mtime_sem); > rpc_execute(&data->task); > > dprintk("NFS: %5u rescheduled direct write call (req %s/%Ld, %u bytes @ offset %Lu)\n", >@@ -601,6 +603,7 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l > { > struct nfs_open_context *ctx = dreq->ctx; > struct inode *inode = ctx->path.dentry->d_inode; >+ struct nfs_inode *nfsi = NFS_I(inode); > size_t wsize = NFS_SERVER(inode)->wsize; > unsigned int pgbase; > int result; >@@ -659,6 +662,7 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l > data->task.tk_cookie = (unsigned long) inode; > > lock_kernel(); >+ down_read(&nfsi->mtime_sem); > rpc_execute(&data->task); > unlock_kernel(); > >diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c >index 612fddd..df44bcb 100644 >--- a/fs/nfs/inode.c >+++ b/fs/nfs/inode.c >@@ -625,7 +625,9 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) > if (NFS_STALE(inode)) > goto out; > >+ down_write(&nfsi->mtime_sem); > status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), &fattr); >+ up_write(&nfsi->mtime_sem); > if (status != 0) { > dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Ld) getattr failed, error=%d\n", > inode->i_sb->s_id, >@@ -1116,6 +1118,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) > INIT_HLIST_HEAD(&nfsi->silly_list); > init_waitqueue_head(&nfsi->waitqueue); > nfs4_init_once(nfsi); >+ init_rwsem(&nfsi->mtime_sem); > } > } > >diff --git a/fs/nfs/write.c b/fs/nfs/write.c >index 69db0fb..5f00449 100644 >--- a/fs/nfs/write.c >+++ b/fs/nfs/write.c >@@ -214,6 +214,7 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode, > int how) > { > unsigned int wsize = NFS_SERVER(inode)->wsize; >+ struct nfs_inode *nfsi = NFS_I(inode); > int result, written = 0; > struct nfs_write_data *wdata; > >@@ -244,7 +245,9 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode, > wdata->args.count = count; > wdata->args.offset = page_offset(page) + wdata->args.pgbase; > >+ down_read(&nfsi->mtime_sem); > result = NFS_PROTO(inode)->write(wdata); >+ up_read(&nfsi->mtime_sem); > > if (result < 0) { > /* Must mark the page invalid after I/O error */ >@@ -1003,10 +1006,12 @@ static void nfs_write_rpcsetup(struct nfs_page *req, > static void nfs_execute_write(struct nfs_write_data *data) > { > struct rpc_clnt *clnt = NFS_CLIENT(data->inode); >+ struct nfs_inode *nfsi = NFS_I(data->inode); > sigset_t oldset; > > rpc_clnt_sigmask(clnt, &oldset); > lock_kernel(); >+ down_read(&nfsi->mtime_sem); > rpc_execute(&data->task); > unlock_kernel(); > rpc_clnt_sigunmask(clnt, &oldset); >@@ -1281,6 +1286,7 @@ int nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data) > dprintk("NFS: %4d nfs_writeback_done (status %d)\n", > task->tk_pid, task->tk_status); > >+ up_read(&NFS_I(data->inode)->mtime_sem); > /* Call the NFS version-specific code */ > status = NFS_PROTO(data->inode)->write_done(task, data); > if (status != 0) >diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h >index 004e5b5..b903aba 100644 >--- a/include/linux/nfs_fs.h >+++ b/include/linux/nfs_fs.h >@@ -188,6 +188,13 @@ struct nfs_inode { > struct hlist_head silly_list; > wait_queue_head_t waitqueue; > >+ /* >+ * overlapping write and getattr calls can lead to >+ * false cache invalidation events. This semaphore helps >+ * ensure that that doesn't happen. >+ */ >+ struct rw_semaphore mtime_sem; >+ > #ifdef CONFIG_NFS_V4 > struct nfs4_cached_acl *nfs4_acl; > /* NFSv4 state */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 438676
:
298904
| 298916