kernel_optimize_test/fs/nfs
Dai Ngo 6e13b9bc66 NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error.
commit f8849e206ef52b584cd9227255f4724f0cc900bb upstream.

Currently if __nfs4_proc_set_acl fails with NFS4ERR_BADOWNER it
re-enables the idmapper by clearing NFS_CAP_UIDGID_NOMAP before
retrying again. The NFS_CAP_UIDGID_NOMAP remains cleared even if
the retry fails. This causes problem for subsequent setattr
requests for v4 server that does not have idmapping configured.

This patch modifies nfs4_proc_set_acl to detect NFS4ERR_BADOWNER
and NFS4ERR_BADNAME and skips the retry, since the kernel isn't
involved in encoding the ACEs, and return -EINVAL.

Steps to reproduce the problem:

 # mount -o vers=4.1,sec=sys server:/export/test /tmp/mnt
 # touch /tmp/mnt/file1
 # chown 99 /tmp/mnt/file1
 # nfs4_setfacl -a A::unknown.user@xyz.com:wrtncy /tmp/mnt/file1
 Failed setxattr operation: Invalid argument
 # chown 99 /tmp/mnt/file1
 chown: changing ownership of ‘/tmp/mnt/file1’: Invalid argument
 # umount /tmp/mnt
 # mount -o vers=4.1,sec=sys server:/export/test /tmp/mnt
 # chown 99 /tmp/mnt/file1
 #

v2: detect NFS4ERR_BADOWNER and NFS4ERR_BADNAME and skip retry
       in nfs4_proc_set_acl.
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-16 12:01:47 +02:00
..
blocklayout
filelayout NFS: fix an incorrect limit in filelayout_decode_layout() 2021-06-03 09:00:35 +02:00
flexfilelayout pNFS/flexfiles: fix incorrect size check in decode_nfs_fh() 2021-05-19 10:13:03 +02:00
cache_lib.c
cache_lib.h
callback_proc.c NFSv4.x: Don't return NFS4ERR_NOMATCHING_LAYOUT if we're unmounting 2021-05-19 10:13:03 +02:00
callback_xdr.c
callback.c
callback.h
client.c NFS: Fix a potential NULL dereference in nfs_get_client() 2021-06-16 12:01:46 +02:00
delegation.c NFS: nfs_delegation_find_inode_server must first reference the superblock 2021-01-19 18:27:31 +01:00
delegation.h
dir.c NFS: Don't gratuitously clear the inode cache when lookup failed 2021-03-17 17:06:33 +01:00
direct.c
dns_resolve.c
dns_resolve.h
export.c
file.c
fs_context.c NFS: fs_context: validate UDP retrans to prevent shift out-of-bounds 2021-05-11 14:47:34 +02:00
fscache-index.c
fscache.c
fscache.h
getroot.c
inode.c NFS: NFS_INO_REVAL_PAGECACHE should mark the change attribute invalid 2021-05-22 11:40:52 +02:00
internal.h NFS: nfs_igrab_and_active must first reference the superblock 2021-01-19 18:27:31 +01:00
io.c
iostat.h
Kconfig nfs: fix PNFS_FLEXFILE_LAYOUT Kconfig default 2021-03-30 14:31:49 +02:00
Makefile
mount_clnt.c
namespace.c NFS: fix nfs_path in case of a rename retry 2020-10-06 10:21:18 -04:00
netns.h
nfs.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c
nfs3client.c
nfs3proc.c
nfs3super.c
nfs3xdr.c NFS: Correct size calculation for create reply length 2021-03-30 14:31:49 +02:00
nfs4_fs.h NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode() 2021-06-16 12:01:46 +02:00
nfs4client.c NFS: Fix use-after-free in nfs4_init_client() 2021-06-16 12:01:46 +02:00
nfs4file.c NFSv4: Fix v4.0/v4.1 SEEK_DATA return -ENOTSUPP when set NFS_V4_2 config 2021-06-03 09:00:36 +02:00
nfs4getroot.c
nfs4idmap.c NFS: Only reference user namespace from nfs4idmap struct instead of cred 2020-10-13 15:56:54 -04:00
nfs4idmap.h
nfs4namespace.c
nfs4proc.c NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error. 2021-06-16 12:01:47 +02:00
nfs4renewd.c
nfs4session.c
nfs4session.h
nfs4state.c
nfs4super.c NFS: Adjust fs_context error logging 2021-01-19 18:27:30 +01:00
nfs4sysctl.c
nfs4trace.c
nfs4trace.h NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE 2020-10-02 08:43:09 -04:00
nfs4xdr.c NFSv4: Fix the alignment of page data in the getdeviceinfo reply 2020-12-30 11:53:30 +01:00
nfs42.h
nfs42proc.c NFSv4.2 fix handling of sr_eof in SEEK's reply 2021-05-19 10:13:03 +02:00
nfs42xattr.c NFSv4.2: fix failure to unregister shrinker 2020-11-12 10:40:02 -05:00
nfs42xdr.c NFSv4.2: Don't error when exiting early on a READ_PLUS buffer overflow 2021-01-06 14:56:55 +01:00
nfsroot.c nfsroot: Default mount option should ask for built-in NFS version 2020-11-02 10:29:03 -05:00
nfstrace.c
nfstrace.h
pagelist.c NFS: Don't corrupt the value of pg_bytes_written in nfs_do_recoalesce() 2021-06-03 09:00:36 +02:00
pnfs_dev.c
pnfs_nfs.c NFS/pNFS: Don't leak DS commits in pnfs_generic_retry_commit() 2021-01-19 18:27:31 +01:00
pnfs.c NFSv4: Fix a NULL pointer dereference in pnfs_mark_matching_lsegs_return() 2021-06-03 09:00:27 +02:00
pnfs.h pNFS: We want return-on-close to complete when evicting the inode 2021-01-19 18:27:30 +01:00
proc.c
read.c
super.c The one new feature this time, from Anna Schumaker, is READ_PLUS, which 2020-10-22 09:44:27 -07:00
symlink.c
sysctl.c
sysfs.c NFSv4: Fix up RCU annotations for struct nfs_netns_client 2020-10-15 13:31:08 -04:00
sysfs.h NFSv4: Fix up RCU annotations for struct nfs_netns_client 2020-10-15 13:31:08 -04:00
unlink.c
write.c