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 296376 Details for
Bug 435443
Add patch to prevent NFS cache invalidation after write 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]
patch3 -- NFS: Fake up 'wcc' attributes to prevent cache invalidation after write
0014-BZ-435443-NFS-Fake-up-wcc-attributes-to-prevent.patch (text/plain), 6.41 KB, created by
Jeff Layton
on 2008-02-29 16:12:55 UTC
(
hide
)
Description:
patch3 -- NFS: Fake up 'wcc' attributes to prevent cache invalidation after write
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-02-29 16:12:55 UTC
Size:
6.41 KB
patch
obsolete
>From 280c687a120b0ec4dafa553511031998e73f8b4b Mon Sep 17 00:00:00 2001 >From: Jeff Layton <jlayton@redhat.com> >Date: Fri, 29 Feb 2008 09:45:12 -0500 >Subject: [PATCH] BZ#435443: NFS: Fake up 'wcc' attributes to prevent cache invalidation after write > >Upstream commit 70ca88521fc7bee8ef0fc22033a439d4b9a2c70d > >NFSv2 and v4 don't offer weak cache consistency attributes on WRITE calls. >In NFSv3, returning wcc data is optional. In all cases, we want to prevent >the client from invalidating our cached data whenever ->write_done() >attempts to update the inode attributes. > >Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> >Backported-by: Jeff Layton <jlayton@redhat.com> >--- > fs/nfs/inode.c | 34 ++++++++++++++++++++++++++++++++++ > fs/nfs/nfs3proc.c | 5 +++-- > fs/nfs/nfs4proc.c | 4 ++-- > fs/nfs/proc.c | 5 +++-- > include/linux/nfs_fs.h | 1 + > include/linux/nfs_xdr.h | 1 + > 6 files changed, 44 insertions(+), 6 deletions(-) > >diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c >index d7f8257..eea0174 100644 >--- a/fs/nfs/inode.c >+++ b/fs/nfs/inode.c >@@ -1328,6 +1328,12 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) > { > struct nfs_inode *nfsi = NFS_I(inode); > >+ if ((fattr->valid & NFS_ATTR_WCC_V4) != 0 && >+ nfsi->change_attr == fattr->pre_change_attr) { >+ nfsi->change_attr = fattr->change_attr; >+ if (S_ISDIR(inode->i_mode)) >+ nfsi->cache_validity |= NFS_INO_INVALID_DATA; >+ } > /* If we have atomic WCC data, we may update some attributes */ > if ((fattr->valid & NFS_ATTR_WCC) != 0) { > if (timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) { >@@ -1462,6 +1468,34 @@ out: > return status; > } > >+/** >+ * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache >+ * @inode - pointer to inode >+ * @fattr - updated attributes >+ * >+ * After an operation that has changed the inode metadata, mark the >+ * attribute cache as being invalid, then try to update it. Fake up >+ * weak cache consistency data, if none exist. >+ * >+ * This function is mainly designed to be used by the ->write_done() functions. >+ */ >+int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr) >+{ >+ if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 && >+ (fattr->valid & NFS_ATTR_WCC_V4) == 0) { >+ fattr->pre_change_attr = NFS_I(inode)->change_attr; >+ fattr->valid |= NFS_ATTR_WCC_V4; >+ } >+ if ((fattr->valid & NFS_ATTR_FATTR) != 0 && >+ (fattr->valid & NFS_ATTR_WCC) == 0) { >+ memcpy(&fattr->pre_ctime, &inode->i_ctime, sizeof(fattr->pre_ctime)); >+ memcpy(&fattr->pre_mtime, &inode->i_mtime, sizeof(fattr->pre_mtime)); >+ fattr->pre_size = inode->i_size; >+ fattr->valid |= NFS_ATTR_WCC; >+ } >+ return nfs_post_op_update_inode(inode, fattr); >+} >+ > /* > * Many nfs protocol calls return the new file attributes after > * an operation. Here we update the inode to reflect the state >diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c >index 92ea53c..8f5f3a1 100644 >--- a/fs/nfs/nfs3proc.c >+++ b/fs/nfs/nfs3proc.c >@@ -267,7 +267,7 @@ static int nfs3_proc_write(struct nfs_write_data *wdata) > nfs_fattr_init(fattr); > status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags); > if (status >= 0) >- nfs_post_op_update_inode(inode, fattr); >+ nfs_post_op_update_inode_force_wcc(inode, fattr); > dprintk("NFS reply write: %d\n", status); > return status < 0? status : wdata->res.count; > } >@@ -776,7 +776,8 @@ nfs3_write_done(struct rpc_task *task) > return; > data = (struct nfs_write_data *)task->tk_calldata; > if (task->tk_status >= 0) >- nfs_post_op_update_inode(data->inode, data->res.fattr); >+ nfs_post_op_update_inode_force_wcc(data->inode, >+ data->res.fattr); > nfs_writeback_done(task); > } > >diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >index d9b01c3..a36e0e1 100644 >--- a/fs/nfs/nfs4proc.c >+++ b/fs/nfs/nfs4proc.c >@@ -1352,7 +1352,7 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata) > nfs_fattr_init(fattr); > status = rpc_call_sync(server->client, &msg, rpcflags); > if (status >= 0) >- nfs_post_op_update_inode(inode, fattr); >+ nfs_post_op_update_inode_force_wcc(inode, fattr); > dprintk("NFS reply write: %d\n", status); > return status; > } >@@ -1972,7 +1972,7 @@ nfs4_write_done(struct rpc_task *task) > } > if (task->tk_status >= 0) { > renew_lease(NFS_SERVER(inode), data->timestamp); >- nfs_post_op_update_inode(inode, data->res.fattr); >+ nfs_post_op_update_inode_force_wcc(inode, data->res.fattr); > } > /* Call back common NFS writeback processing */ > nfs_writeback_done(task); >diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c >index 42138d2..18978ff 100644 >--- a/fs/nfs/proc.c >+++ b/fs/nfs/proc.c >@@ -209,7 +209,7 @@ static int nfs_proc_write(struct nfs_write_data *wdata) > nfs_fattr_init(fattr); > status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags); > if (status >= 0) { >- nfs_post_op_update_inode(inode, fattr); >+ nfs_post_op_update_inode_force_wcc(inode, fattr); > wdata->res.count = wdata->args.count; > wdata->verf.committed = NFS_FILE_SYNC; > } >@@ -593,7 +593,8 @@ nfs_write_done(struct rpc_task *task) > struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; > > if (task->tk_status >= 0) >- nfs_post_op_update_inode(data->inode, data->res.fattr); >+ nfs_post_op_update_inode_force_wcc(data->inode, >+ data->res.fattr); > nfs_writeback_done(task); > } > >diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h >index 2a6f3d7..f299a87 100644 >--- a/include/linux/nfs_fs.h >+++ b/include/linux/nfs_fs.h >@@ -323,6 +323,7 @@ extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, > struct nfs_fattr *); > extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); > extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); >+extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); > extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); > extern int nfs_getattr64(struct vfsmount *, struct dentry *, struct kstat64 *); > extern int nfs_permission(struct inode *, int, struct nameidata *); >diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h >index 9833594..54185c5 100644 >--- a/include/linux/nfs_xdr.h >+++ b/include/linux/nfs_xdr.h >@@ -48,6 +48,7 @@ struct nfs_fattr { > #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ > #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ > #define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */ >+#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */ > > /* > * Info on the file system >-- >1.5.3.6 >
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 435443
:
296373
|
296374
| 296376 |
296811