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 309490 Details for
Bug 436132
Reduce NFS cache invalidations due to writes from same client
[?]
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: change nfs_refresh_inode and __nfs_revalidate_inode to detect overlapping writes
03-nfs-change-nfs_refresh_inode-t.patch (text/plain), 3.41 KB, created by
Jeff Layton
on 2008-06-16 13:17:03 UTC
(
hide
)
Description:
patch3 - NFS: change nfs_refresh_inode and __nfs_revalidate_inode to detect overlapping writes
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-06-16 13:17:03 UTC
Size:
3.41 KB
patch
obsolete
>NFS: change nfs_refresh_inode to detect overlapping writes > >From: Jeff Layton <jlayton@redhat.com> > >When a call that returns post_op_attrs overlaps with a write, then >the attributes returned are suspect. It could reflect the status of >the inode at any time before, during or after the write and we can't >predict which. > >When this happens we don't want to invalidate the cached data since >that can be very expensive. Instead, just update the inode attributes >and mark the attrcache as invalid. Also in this case, if the mtime >would move backward, then don't even update the attributes. Just mark >the attrcache as invalid. >--- > > fs/nfs/inode.c | 39 +++++++++++++++++++++++++++++++++++---- > 1 files changed, 35 insertions(+), 4 deletions(-) > > >diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c >index 4808cea..ab388bf 100644 >--- a/fs/nfs/inode.c >+++ b/fs/nfs/inode.c >@@ -55,6 +55,7 @@ > static int enable_ino64 = NFS_64_BIT_INODE_NUMBERS_ENABLED; > > static void nfs_invalidate_inode(struct inode *); >+static bool nfs_overlapping_write(struct inode *inode, struct nfs_fattr *fattr); > static int nfs_update_inode(struct inode *, struct nfs_fattr *); > > static void nfs_zap_acl_cache(struct inode *); >@@ -675,7 +676,12 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) > } > > spin_lock(&inode->i_lock); >- status = nfs_update_inode(inode, &fattr); >+ >+ if (nfs_overlapping_write(inode, &fattr)) >+ nfs_update_inode_attributes(inode, &fattr); >+ else >+ status = nfs_update_inode(inode, &fattr); >+ > if (status) { > spin_unlock(&inode->i_lock); > dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Ld) refresh failed, error=%d\n", >@@ -899,6 +905,28 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat > return 0; > } > >+/* >+ * nfs_overlapping_write - determine whether a write overlapped with this call >+ * @inode - pointer to inode >+ * @fattr - updated attributes >+ * >+ * Did the call that returned these attributes overlap with a write to the >+ * same inode? >+ */ >+static bool >+nfs_overlapping_write(struct inode *inode, struct nfs_fattr *fattr) >+{ >+ struct nfs_inode *nfsi = NFS_I(inode); >+ unsigned long now = jiffies; >+ >+ if (nfsi->nwrites != 0 || >+ time_in_range(nfsi->last_write_start, fattr->time_start, now) || >+ time_in_range(nfsi->last_write_done, fattr->time_start, now)) >+ return true; >+ >+ return false; >+} >+ > /** > * nfs_refresh_inode - try to update the inode attribute cache > * @inode - pointer to inode >@@ -912,16 +940,17 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat > int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) > { > struct nfs_inode *nfsi = NFS_I(inode); >- int status; >+ int status = 0; > > if ((fattr->valid & NFS_ATTR_FATTR) == 0) > return 0; > spin_lock(&inode->i_lock); >- if (time_after(fattr->time_start, nfsi->last_updated)) >+ if (nfs_overlapping_write(inode, fattr)) >+ nfs_update_inode_attributes(inode, fattr); >+ else if (time_after(fattr->time_start, nfsi->last_updated)) > status = nfs_update_inode(inode, fattr); > else > status = nfs_check_inode_attributes(inode, fattr); >- > spin_unlock(&inode->i_lock); > return status; > } >@@ -982,6 +1011,8 @@ nfs_update_inode_attributes(struct inode *inode, struct nfs_fattr *fattr) > memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); > memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); > } >+ >+ /* mark attrcache as suspect */ > nfsi->cache_validity |= NFS_INO_INVALID_ATTR; > } >
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 436132
:
297190
|
297191
|
297250
|
297251
|
297252
|
309488
|
309489
|
309490
|
309620