All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs: ensure that attrcache is revalidated after a SETATTR
@ 2015-11-25 18:50 Jeff Layton
  2015-11-25 22:12 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2015-11-25 18:50 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs

If we get no post-op attributes back from a SETATTR operation, then no
attributes will of course be updated during the call to
nfs_update_inode.

We know however that the attributes are invalid at that point, since we
just changed some of them. At the very least, the ctime will be bogus.
If we get no post-op attributes back on the call, mark the attrcache
invalid to reflect that fact.

Reviewed-by: Steve French <steve.french@primarydata.com>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
---
 fs/nfs/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index ffdf9b9e88ab..31b0a52223a7 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -618,7 +618,10 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,
 		nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC);
 		nfs_vmtruncate(inode, attr->ia_size);
 	}
-	nfs_update_inode(inode, fattr);
+	if (fattr->valid)
+		nfs_update_inode(inode, fattr);
+	else
+		NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR;
 	spin_unlock(&inode->i_lock);
 }
 EXPORT_SYMBOL_GPL(nfs_setattr_update_inode);
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfs: ensure that attrcache is revalidated after a SETATTR
  2015-11-25 18:50 [PATCH] nfs: ensure that attrcache is revalidated after a SETATTR Jeff Layton
@ 2015-11-25 22:12 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2015-11-25 22:12 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Trond Myklebust, linux-nfs

I tested it on a previously failing chmod/chattr/stat scenario (where
client was relying on cached mode even though server didn't return
post op attributes, and so reported an incorrect mode in stat) and it
fixes that

Reviewed-and-Tested-by: Steve French <steve.french@primarydata.com>

On Wed, Nov 25, 2015 at 12:50 PM, Jeff Layton <jlayton@poochiereds.net> wrote:
> If we get no post-op attributes back from a SETATTR operation, then no
> attributes will of course be updated during the call to
> nfs_update_inode.
>
> We know however that the attributes are invalid at that point, since we
> just changed some of them. At the very least, the ctime will be bogus.
> If we get no post-op attributes back on the call, mark the attrcache
> invalid to reflect that fact.
>
> Reviewed-by: Steve French <steve.french@primarydata.com>
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
> ---
>  fs/nfs/inode.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index ffdf9b9e88ab..31b0a52223a7 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -618,7 +618,10 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr,
>                 nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC);
>                 nfs_vmtruncate(inode, attr->ia_size);
>         }
> -       nfs_update_inode(inode, fattr);
> +       if (fattr->valid)
> +               nfs_update_inode(inode, fattr);
> +       else
> +               NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR;
>         spin_unlock(&inode->i_lock);
>  }
>  EXPORT_SYMBOL_GPL(nfs_setattr_update_inode);
> --
> 2.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-25 22:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 18:50 [PATCH] nfs: ensure that attrcache is revalidated after a SETATTR Jeff Layton
2015-11-25 22:12 ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.