If delegation is enabled and code has a wrong statement that result in
issuing a write delegation on a readonly file.
Submitted by: Fatih ACAR <fatih.acar@gandi.net>
Differential D7891
Fix nfs 4.1 giving write delegation on a readonly filesystam bapt on Sep 14 2016, 1:25 PM. Authored by Tags None Referenced Files
Subscribers
Details If delegation is enabled and code has a wrong statement that result in Submitted by: Fatih ACAR <fatih.acar@gandi.net> The following scripts allows to reproduce the issue (tested on a linux client) #!/bin/sh file="file="/srv/nfs/X.X.X.X_VFS_hosting-1463916/test" if [ -f "$file" ]; then id # uid=0(root) gid=0(root) groups=0(root) content=`cat $file` # this will open the file and wrongly get write delegation for uid 0 echo "file content: $content" stat "$file" # File: '/srv/nfs/X.X.X.X_VFS_hosting-1463916/test' # Size: 7 Blocks: 1 IO Block: 131072 regular file # Device: 2bh/43d Inode: 321333 Links: 1 # Access: (0664/-rw-rw-r--) Uid: ( 5101/hosting-db) Gid: ( 5101/hosting-db) sleep 2 echo "trying tee as hosting-db" su hosting-db -s /bin/bash -c 'echo blabbb | tee '$file'' # this will try to setattr using the cached write delegation with uid 0 # should output: tee: /srv/nfs/X.X.X.X_VFS_hosting-1463916/test: Permission denied fi
Diff Detail
Event TimelineComment Actions Well, I believe that the current behaviour (without this patch) is correct. by the RFCs as far as I understand them and allows the client more flexibility w.r.t. subsequent Opens done locally within the client. By default the only times the server issues a Read Delegation is when the file If you want the behaviour that you describe, change the value of a sysctl to make it "LInux compatible" seems appropriate. rick Comment Actions Just fyi, the above commit to head (r307694) will be MFC'd in 2 weeks. It changes the default |