+++ This bug was initially created as a clone of Bug #1093093 +++ +++ This bug was initially created as a clone of Bug #1043558 +++ Description of problem: when chown a file on nfsv4 mount it seems to not respect NFSv4 no_root_squash option: NFS server export: [root@nfs ~]# cat /etc/exports /scratch *(rw,fsid=0,async,insecure,no_root_squash) [root@nfs ~]# exportfs -rv exporting *:/scratch NFS Client: [root@client ~]# mount -t nfs -o vers=4 nfs.example.org:/ /mnt/rhel6/ [root@client ~]# cat /proc/mounts rootfs / rootfs rw 0 0 proc /proc proc rw,relatime 0 0 sysfs /sys sysfs rw,relatime 0 0 devtmpfs /dev devtmpfs rw,relatime,size=500204k,nr_inodes=125051,mode=755 0 0 devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /dev/shm tmpfs rw,relatime 0 0 /dev/mapper/myvg-rootvol / ext4 rw,relatime,barrier=1,data=ordered 0 0 /proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0 /dev/vda1 /boot ext3 rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered 0 0 none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0 sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0 nfs.example.org:/ /mnt/rhel6 nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.33.20.36,minorversion=0,local_lock=none,addr=10.33.20.128 0 0 Create a file: [root@client ~]# touch /mnt/rhel6/testfile_root [root@client ~]# ll /mnt/rhel6/testfile_root -rw-r--r-- 1 root root 0 Dec 16 2013 /mnt/rhel6/testfile_root Chown the file: [root@client ~]# chown root:root /mnt/rhel6/testfile_root [root@client ~]# ll /mnt/rhel6/testfile_root -rw-r--r-- 1 nobody nobody 0 Dec 16 2013 /mnt/rhel6/testfile_root Doing the same for a "normal" user works as expected: [root@client ~]# su - test Create a file: [test@client ~]$ touch /mnt/rhel6/testfile_test [test@client ~]$ ll /mnt/rhel6/testfile_test -rw-rw-r-- 1 test test 0 Dec 16 2013 /mnt/rhel6/testfile_test Chown the file: [test@client ~]$ chown test:test /mnt/rhel6/testfile_test [test@client ~]$ ll /mnt/rhel6/testfile_test -rw-rw-r-- 1 test test 0 Dec 16 2013 /mnt/rhel6/testfile_test How reproducible: always Steps to Reproduce: 1. cat /etc/exports /scratch *(rw,fsid=0,async,insecure,no_root_squash) 2. # mount -t nfs -o vers=4 nfs.example.org:/ /mnt/rhel6/ 3. # touch /mnt/rhel6/testfile_root => check file perms: -rw-r--r-- 1 root root 0 Dec 16 2013 /mnt/rhel6/testfile_root 4. # chown root:root /mnt/rhel6/testfile_root => check file perms: -rw-r--r-- 1 nobody nobody 0 Dec 16 2013 /mnt/rhel6/testfile_root Actual results: chown to root:root results in nobody:nobody Expected results: chown to root:root results in root:root --- Additional comment from Martin Schuppert on 2013-12-16 11:29:55 EST --- It works when setting nfs4_disable_idmapping=n [root@client ~]# cat /etc/modprobe.d/nfs.conf options nfs nfs4_disable_idmapping=n [root@client ~]# mount -t nfs -o vers=4 nfs.example.org:/ /mnt/rhel6/ [root@client ~]# touch /mnt/rhel6/testfile_rootttt [root@client ~]# ll /mnt/rhel6/testfile_rootttt -rw-r--r-- 1 root root 0 Dec 16 2013 /mnt/rhel6/testfile_rootttt [root@client ~]# chown root:root /mnt/rhel6/testfile_rootttt [root@client ~]# ll /mnt/rhel6/testfile_rootttt -rw-r--r-- 1 root root 0 Dec 16 2013 /mnt/rhel6/testfile_rootttt .. --- Additional comment from Steve Dickson on 2014-04-30 10:55:30 EDT --- This is the needed fix for libnfsidmap diff -up ./libnfsidmap.c.orig ./libnfsidmap.c --- ./libnfsidmap.c.orig 2014-04-30 10:19:28.000000000 -0400 +++ ./libnfsidmap.c 2014-04-30 10:49:05.000000000 -0400 @@ -99,8 +99,12 @@ static char * toupper_str(char *s) static int id_as_chars(char *name, int *id) { long int value = strtol(name, NULL, 10); - if (value == 0) - return 0; + + if (value == 0) { + /* check for zero id values */ + if (strcmp(name, "0") != 0) + return 0; + } *id = (int)value; return 1; } --- Additional comment from Steve Dickson on 2014-04-30 10:56:31 EDT --- Looking for a QE ack...
This problem does not happen with new kernels since they don't use libnfsidmap
Reopening... I'm going to make the fix ways....
libnfsidmap-0.25-8.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/libnfsidmap-0.25-8.fc19
libnfsidmap-0.25-8.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/libnfsidmap-0.25-8.fc20
Package libnfsidmap-0.25-8.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing libnfsidmap-0.25-8.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-5873/libnfsidmap-0.25-8.fc20 then log in and leave karma (feedback).
libnfsidmap-0.25-8.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
libnfsidmap-0.25-8.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.