Skip to contentSkip to conversation

nfs: drop acl cache in __nfs3_proc_setacls

PATCH In review yangerkun 2 participants 4 messages Feb 20, 2019 – Feb 23, 2019

Subsystems (2)
lore
Share & tools
lore

yangerkun

author
#0 lore raw

PATCH 1/1 nfs: drop acl cache in __nfs3_proc_setacls

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.

---
 fs/nfs/nfs3acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs3acl.c +2 -2
index 9fce185..6c07ebc 100644
@@ -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:
Signature · 1 line
2.9.5
author
#1 lore raw

Ping?

yangerkun wrote on 2019/2/20 15:29:

Quoted 26 lines

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.

---
  fs/nfs/nfs3acl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs3acl.c +2 -2
index 9fce185..6c07ebc 100644
@@ -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 lore raw

Hi,

Quoted 24 lines · yangerkun

Ping?

yangerkun wrote on 2019/2/20 15:29:

Quoted 21 lines

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.

---
  fs/nfs/nfs3acl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs3acl.c +0 -0
index 9fce185..6c07ebc 100644
@@ -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);
Quoted 8 lines
Quoted 8 lines
fs/nfs/nfs3acl.c +2 -2
-			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

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]
author
#3 lore raw

Trond Myklebust wrote on 2019/2/22 21:51:

Quoted 40 lines

Hi,

Quoted 24 lines · yangerkun

Ping?

yangerkun wrote on 2019/2/20 15:29:

Quoted 21 lines

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.

---
   fs/nfs/nfs3acl.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs3acl.c +0 -0
index 9fce185..6c07ebc 100644
@@ -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);
Quoted 8 lines
Quoted 8 lines
fs/nfs/nfs3acl.c +2 -2
-			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.

Quoted 7 lines

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.