linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: drop acl cache in __nfs3_proc_setacls
@ 2019-02-20  7:29 yangerkun
  2019-02-22  7:35 ` yangerkun
  0 siblings, 1 reply; 4+ messages in thread
From: yangerkun @ 2019-02-20  7:29 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker
  Cc: houtao1, zhangxiaoxu5, yi.zhang, yangerkun, linux-nfs

Since server may call posix_acl_update_mode which can lead acl been
NULL. So,just drop acl cache after rpc_call_sync, and if anyone want to
use acl, they can get the correct acl by send a msg to server themselves.
This can fix xfstests generic/099 over nfsv3.

Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 fs/nfs/nfs3acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 9fce185..6c07ebc 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -222,8 +222,8 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
 	switch (status) {
 		case 0:
 			status = nfs_refresh_inode(inode, fattr);
-			set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
-			set_cached_acl(inode, ACL_TYPE_DEFAULT, dfacl);
+			/* Sever may call posix_acl_update_mode */
+			forget_all_cached_acls(inode);
 			break;
 		case -EPFNOSUPPORT:
 		case -EPROTONOSUPPORT:
-- 
2.9.5


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

* Re: [PATCH] nfs: drop acl cache in __nfs3_proc_setacls
  2019-02-20  7:29 [PATCH] nfs: drop acl cache in __nfs3_proc_setacls yangerkun
@ 2019-02-22  7:35 ` yangerkun
  2019-02-22 13:51   ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: yangerkun @ 2019-02-22  7:35 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker
  Cc: houtao1, zhangxiaoxu5, yi.zhang, linux-nfs

Ping?

yangerkun wrote on 2019/2/20 15:29:
> Since server may call posix_acl_update_mode which can lead acl been
> NULL. So,just drop acl cache after rpc_call_sync, and if anyone want to
> use acl, they can get the correct acl by send a msg to server themselves.
> This can fix xfstests generic/099 over nfsv3.
> 
> Signed-off-by: yangerkun <yangerkun@huawei.com>
> ---
>   fs/nfs/nfs3acl.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
> index 9fce185..6c07ebc 100644
> --- a/fs/nfs/nfs3acl.c
> +++ b/fs/nfs/nfs3acl.c
> @@ -222,8 +222,8 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
>   	switch (status) {
>   		case 0:
>   			status = nfs_refresh_inode(inode, fattr);
> -			set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
> -			set_cached_acl(inode, ACL_TYPE_DEFAULT, dfacl);
> +			/* Sever may call posix_acl_update_mode */
> +			forget_all_cached_acls(inode);
>   			break;
>   		case -EPFNOSUPPORT:
>   		case -EPROTONOSUPPORT:
> 


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

* Re: [PATCH] nfs: drop acl cache in __nfs3_proc_setacls
  2019-02-22  7:35 ` yangerkun
@ 2019-02-22 13:51   ` Trond Myklebust
  2019-02-23  2:00     ` yangerkun
  0 siblings, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2019-02-22 13:51 UTC (permalink / raw)
  To: yangerkun, anna.schumaker; +Cc: yi.zhang, houtao1, linux-nfs, zhangxiaoxu5

Hi,

On Fri, 2019-02-22 at 15:35 +0800, yangerkun wrote:
> Ping?
> 
> yangerkun wrote on 2019/2/20 15:29:
> > Since server may call posix_acl_update_mode which can lead acl been
> > NULL. So,just drop acl cache after rpc_call_sync, and if anyone
> > want to
> > use acl, they can get the correct acl by send a msg to server
> > themselves.
> > This can fix xfstests generic/099 over nfsv3.
> > 
> > Signed-off-by: yangerkun <yangerkun@huawei.com>
> > ---
> >   fs/nfs/nfs3acl.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
> > index 9fce185..6c07ebc 100644
> > --- a/fs/nfs/nfs3acl.c
> > +++ b/fs/nfs/nfs3acl.c
> > @@ -222,8 +222,8 @@ static int __nfs3_proc_setacls(struct inode
> > *inode, struct posix_acl *acl,
> >   	switch (status) {
> >   		case 0:
> >   			status = nfs_refresh_inode(inode, fattr);
> > -			set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
> > -			set_cached_acl(inode, ACL_TYPE_DEFAULT, dfacl);
> > +			/* Sever may call posix_acl_update_mode */
> > +			forget_all_cached_acls(inode);
> >   			break;
> >   		case -EPFNOSUPPORT:
> >   		case -EPROTONOSUPPORT:
> > 

I've applied the following patch 
http://git.linux-nfs.org/?p=trondmy/linux-nfs.git;a=commitdiff;h=ded52fbe7020a5696b0b0a0fdbf234e37bf16f94
in order to fix this issue.

The reason why I prefer that fix is that we're already calling
nfs_zap_acl_cache(inode) immediately before this switch statement, so
the call to 'forget_all_cached_acls()' appears redundant.

Thanks!
  Trond 

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



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

* Re: [PATCH] nfs: drop acl cache in __nfs3_proc_setacls
  2019-02-22 13:51   ` Trond Myklebust
@ 2019-02-23  2:00     ` yangerkun
  0 siblings, 0 replies; 4+ messages in thread
From: yangerkun @ 2019-02-23  2:00 UTC (permalink / raw)
  To: Trond Myklebust, anna.schumaker
  Cc: yi.zhang, houtao1, linux-nfs, zhangxiaoxu5



Trond Myklebust wrote on 2019/2/22 21:51:
> Hi,
> 
> On Fri, 2019-02-22 at 15:35 +0800, yangerkun wrote:
>> Ping?
>>
>> yangerkun wrote on 2019/2/20 15:29:
>>> Since server may call posix_acl_update_mode which can lead acl been
>>> NULL. So,just drop acl cache after rpc_call_sync, and if anyone
>>> want to
>>> use acl, they can get the correct acl by send a msg to server
>>> themselves.
>>> This can fix xfstests generic/099 over nfsv3.
>>>
>>> Signed-off-by: yangerkun <yangerkun@huawei.com>
>>> ---
>>>    fs/nfs/nfs3acl.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
>>> index 9fce185..6c07ebc 100644
>>> --- a/fs/nfs/nfs3acl.c
>>> +++ b/fs/nfs/nfs3acl.c
>>> @@ -222,8 +222,8 @@ static int __nfs3_proc_setacls(struct inode
>>> *inode, struct posix_acl *acl,
>>>    	switch (status) {
>>>    		case 0:
>>>    			status = nfs_refresh_inode(inode, fattr);
>>> -			set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
>>> -			set_cached_acl(inode, ACL_TYPE_DEFAULT, dfacl);
>>> +			/* Sever may call posix_acl_update_mode */
>>> +			forget_all_cached_acls(inode);
>>>    			break;
>>>    		case -EPFNOSUPPORT:
>>>    		case -EPROTONOSUPPORT:
>>>
> 
> I've applied the following patch
> http://git.linux-nfs.org/?p=trondmy/linux-nfs.git;a=commitdiff;h=ded52fbe7020a5696b0b0a0fdbf234e37bf16f94
> in order to fix this issue.
> 
> The reason why I prefer that fix is that we're already calling
> nfs_zap_acl_cache(inode) immediately before this switch statement, so
> the call to 'forget_all_cached_acls()' appears redundant.
> 
> Thanks!
>    Trond
> 
Got it! Thanks a lot!

Kun.


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

end of thread, other threads:[~2019-02-23  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-20  7:29 [PATCH] nfs: drop acl cache in __nfs3_proc_setacls yangerkun
2019-02-22  7:35 ` yangerkun
2019-02-22 13:51   ` Trond Myklebust
2019-02-23  2:00     ` yangerkun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).