1. 19 3月, 2012 2 次提交
  2. 06 1月, 2012 1 次提交
    • C
      NFSD: Change name of extended attribute containing junction · 9b4146e8
      Chuck Lever 提交于
      As of fedfs-utils-0.8.0, user space stores all NFS junction
      information in a single extended attribute: "trusted.junction.nfs".
      
      Both FedFS and NFS basic junctions are stored in this one attribute,
      and the intention is that all future forms of NFS junction metadata
      will be stored in this attribute.  Other protocols may use a different
      extended attribute.
      
      Thus NFSD needs to look only for that one extended attribute.  The
      "trusted.junction.type" xattr is deprecated.  fedfs-utils-0.8.0 will
      continue to attach a "trusted.junction.type" xattr to junctions, but
      future fedfs-utils releases may no longer do that.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      9b4146e8
  3. 04 1月, 2012 2 次提交
  4. 18 10月, 2011 1 次提交
  5. 14 9月, 2011 1 次提交
  6. 28 8月, 2011 1 次提交
    • J
      nfsd4: permit read opens of executable-only files · a043226b
      J. Bruce Fields 提交于
      A client that wants to execute a file must be able to read it.  Read
      opens over nfs are therefore implicitly allowed for executable files
      even when those files are not readable.
      
      NFSv2/v3 get this right by using a passed-in NFSD_MAY_OWNER_OVERRIDE on
      read requests, but NFSv4 has gotten this wrong ever since
      dc730e17 "nfsd4: fix owner-override on
      open", when we realized that the file owner shouldn't override
      permissions on non-reclaim NFSv4 opens.
      
      So we can't use NFSD_MAY_OWNER_OVERRIDE to tell nfsd_permission to allow
      reads of executable files.
      
      So, do the same thing we do whenever we encounter another weird NFS
      permission nit: define yet another NFSD_MAY_* flag.
      
      The industry's future standardization on 128-bit processors will be
      motivated primarily by the need for integers with enough bits for all
      the NFSD_MAY_* flags.
      Reported-by: NLeonardo Borda <leonardoborda@gmail.com>
      Cc: stable@kernel.org
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      a043226b
  7. 27 8月, 2011 2 次提交
  8. 20 6月, 2011 1 次提交
  9. 07 6月, 2011 1 次提交
  10. 30 4月, 2011 2 次提交
  11. 20 4月, 2011 1 次提交
    • S
      Open with O_CREAT flag set fails to open existing files on non writable directories · 1574dff8
      Sachin Prabhu 提交于
      An open on a NFS4 share using the O_CREAT flag on an existing file for
      which we have permissions to open but contained in a directory with no
      write permissions will fail with EACCES.
      
      A tcpdump shows that the client had set the open mode to UNCHECKED which
      indicates that the file should be created if it doesn't exist and
      encountering an existing flag is not an error. Since in this case the
      file exists and can be opened by the user, the NFS server is wrong in
      attempting to check create permissions on the parent directory.
      
      The patch adds a conditional statement to check for create permissions
      only if the file doesn't exist.
      Signed-off-by: NSachin S. Prabhu <sprabhu@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      1574dff8
  12. 11 4月, 2011 2 次提交
  13. 18 3月, 2011 1 次提交
  14. 08 3月, 2011 1 次提交
    • J
      NFSD, VFS: Remove dead code in nfsd_rename() · 46d4cef9
      Jesper Juhl 提交于
      Currently we have the following code in fs/nfsd/vfs.c::nfsd_rename() :
      
      	...
      	host_err = nfsd_break_lease(odentry->d_inode);
      	if (host_err)
      		goto out_drop_write;
      	if (ndentry->d_inode) {
      		host_err = nfsd_break_lease(ndentry->d_inode);
      		if (host_err)
      			goto out_drop_write;
      	}
      	if (host_err)
      		goto out_drop_write;
      	...
      
      'host_err' is guaranteed to be 0 by the time we test 'ndentry->d_inode'.
      If 'host_err' becomes != 0 inside the 'if' statement, then we goto
      'out_drop_write'. So, after the 'if' statement there is no way that
      'host_err' can be anything but 0, so the test afterwards is just dead
      code.
      This patch removes the dead code.
      Signed-off-by: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      46d4cef9
  15. 14 2月, 2011 3 次提交
  16. 16 1月, 2011 1 次提交
    • D
      Add a dentry op to allow processes to be held during pathwalk transit · cc53ce53
      David Howells 提交于
      Add a dentry op (d_manage) to permit a filesystem to hold a process and make it
      sleep when it tries to transit away from one of that filesystem's directories
      during a pathwalk.  The operation is keyed off a new dentry flag
      (DCACHE_MANAGE_TRANSIT).
      
      The filesystem is allowed to be selective about which processes it holds and
      which it permits to continue on or prohibits from transiting from each flagged
      directory.  This will allow autofs to hold up client processes whilst letting
      its userspace daemon through to maintain the directory or the stuff behind it
      or mounted upon it.
      
      The ->d_manage() dentry operation:
      
      	int (*d_manage)(struct path *path, bool mounting_here);
      
      takes a pointer to the directory about to be transited away from and a flag
      indicating whether the transit is undertaken by do_add_mount() or
      do_move_mount() skipping through a pile of filesystems mounted on a mountpoint.
      
      It should return 0 if successful and to let the process continue on its way;
      -EISDIR to prohibit the caller from skipping to overmounted filesystems or
      automounting, and to use this directory; or some other error code to return to
      the user.
      
      ->d_manage() is called with namespace_sem writelocked if mounting_here is true
      and no other locks held, so it may sleep.  However, if mounting_here is true,
      it may not initiate or wait for a mount or unmount upon the parameter
      directory, even if the act is actually performed by userspace.
      
      Within fs/namei.c, follow_managed() is extended to check with d_manage() first
      on each managed directory, before transiting away from it or attempting to
      automount upon it.
      
      follow_down() is renamed follow_down_one() and should only be used where the
      filesystem deliberately intends to avoid management steps (e.g. autofs).
      
      A new follow_down() is added that incorporates the loop done by all other
      callers of follow_down() (do_add/move_mount(), autofs and NFSD; whilst AFS, NFS
      and CIFS do use it, their use is removed by converting them to use
      d_automount()).  The new follow_down() calls d_manage() as appropriate.  It
      also takes an extra parameter to indicate if it is being called from mount code
      (with namespace_sem writelocked) which it passes to d_manage().  follow_down()
      ignores automount points so that it can be used to mount on them.
      
      __follow_mount_rcu() is made to abort rcu-walk mode if it hits a directory with
      DCACHE_MANAGE_TRANSIT set on the basis that we're probably going to have to
      sleep.  It would be possible to enter d_manage() in rcu-walk mode too, and have
      that determine whether to abort or not itself.  That would allow the autofs
      daemon to continue on in rcu-walk mode.
      
      Note that DCACHE_MANAGE_TRANSIT on a directory should be cleared when it isn't
      required as every tranist from that directory will cause d_manage() to be
      invoked.  It can always be set again when necessary.
      
      ==========================
      WHAT THIS MEANS FOR AUTOFS
      ==========================
      
      Autofs currently uses the lookup() inode op and the d_revalidate() dentry op to
      trigger the automounting of indirect mounts, and both of these can be called
      with i_mutex held.
      
      autofs knows that the i_mutex will be held by the caller in lookup(), and so
      can drop it before invoking the daemon - but this isn't so for d_revalidate(),
      since the lock is only held on _some_ of the code paths that call it.  This
      means that autofs can't risk dropping i_mutex from its d_revalidate() function
      before it calls the daemon.
      
      The bug could manifest itself as, for example, a process that's trying to
      validate an automount dentry that gets made to wait because that dentry is
      expired and needs cleaning up:
      
      	mkdir         S ffffffff8014e05a     0 32580  24956
      	Call Trace:
      	 [<ffffffff885371fd>] :autofs4:autofs4_wait+0x674/0x897
      	 [<ffffffff80127f7d>] avc_has_perm+0x46/0x58
      	 [<ffffffff8009fdcf>] autoremove_wake_function+0x0/0x2e
      	 [<ffffffff88537be6>] :autofs4:autofs4_expire_wait+0x41/0x6b
      	 [<ffffffff88535cfc>] :autofs4:autofs4_revalidate+0x91/0x149
      	 [<ffffffff80036d96>] __lookup_hash+0xa0/0x12f
      	 [<ffffffff80057a2f>] lookup_create+0x46/0x80
      	 [<ffffffff800e6e31>] sys_mkdirat+0x56/0xe4
      
      versus the automount daemon which wants to remove that dentry, but can't
      because the normal process is holding the i_mutex lock:
      
      	automount     D ffffffff8014e05a     0 32581      1              32561
      	Call Trace:
      	 [<ffffffff80063c3f>] __mutex_lock_slowpath+0x60/0x9b
      	 [<ffffffff8000ccf1>] do_path_lookup+0x2ca/0x2f1
      	 [<ffffffff80063c89>] .text.lock.mutex+0xf/0x14
      	 [<ffffffff800e6d55>] do_rmdir+0x77/0xde
      	 [<ffffffff8005d229>] tracesys+0x71/0xe0
      	 [<ffffffff8005d28d>] tracesys+0xd5/0xe0
      
      which means that the system is deadlocked.
      
      This patch allows autofs to hold up normal processes whilst the daemon goes
      ahead and does things to the dentry tree behind the automouter point without
      risking a deadlock as almost no locks are held in d_manage() and none in
      d_automount().
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Was-Acked-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      cc53ce53
  17. 14 1月, 2011 3 次提交
    • J
      nfsd: break lease on unlink, link, and rename · 4795bb37
      J. Bruce Fields 提交于
      Any change to any of the links pointing to an entry should also break
      delegations.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      4795bb37
    • J
      nfsd4: break lease on nfsd setattr · 6a76bebe
      J. Bruce Fields 提交于
      Leases (delegations) should really be broken on any metadata change, not
      just on size change.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      6a76bebe
    • J
      nfsd: don't support msnfs export option · 9ce137ee
      J. Bruce Fields 提交于
      We've long had these pointless #ifdef MSNFS's sprinkled throughout the
      code--pointless because MSNFS is always defined (and we give no config
      option to make that easy to change).  So we could just remove the
      ifdef's and compile the resulting code unconditionally.
      
      But as long as we're there: why not just rip out this code entirely?
      The only purpose is to implement the "msnfs" export option which turns
      on Windows-like behavior in some cases, and:
      
      	- the export option isn't documented anywhere;
      	- the userland utilities (which would need to be able to parse
      	  "msnfs" in an export file) don't support it;
      	- I don't know how to maintain this, as I don't know what the
      	  proper behavior is; and
      	- google shows no evidence that anyone has ever used this.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      9ce137ee
  18. 07 1月, 2011 1 次提交
  19. 05 1月, 2011 2 次提交
  20. 20 12月, 2010 1 次提交
  21. 17 12月, 2010 1 次提交
  22. 26 10月, 2010 1 次提交
  23. 27 8月, 2010 1 次提交
  24. 10 8月, 2010 1 次提交
    • C
      pass a struct path to vfs_statfs · ebabe9a9
      Christoph Hellwig 提交于
      We'll need the path to implement the flags field for statvfs support.
      We do have it available in all callers except:
      
       - ecryptfs_statfs.  This one doesn't actually need vfs_statfs but just
         needs to do a caller to the lower filesystem statfs method.
       - sys_ustat.  Add a non-exported statfs_by_dentry helper for it which
         doesn't won't be able to fill out the flags field later on.
      
      In addition rename the helpers for statfs vs fstatfs to do_*statfs instead
      of the misleading vfs prefix.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ebabe9a9
  25. 31 7月, 2010 1 次提交
  26. 30 7月, 2010 1 次提交
  27. 28 7月, 2010 2 次提交
    • E
      fsnotify: pass a file instead of an inode to open, read, and write · 2a12a9d7
      Eric Paris 提交于
      fanotify, the upcoming notification system actually needs a struct path so it can
      do opens in the context of listeners, and it needs a file so it can get f_flags
      from the original process.  Close was the only operation that already was passing
      a struct file to the notification hook.  This patch passes a file for access,
      modify, and open as well as they are easily available to these hooks.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      2a12a9d7
    • J
      nfsd: bypass readahead cache when have struct file · fa0a2126
      J. Bruce Fields 提交于
      The readahead cache compensates for the fact that the NFS server
      currently does an open and close on every IO operation in the NFSv2 and
      NFSv3 case.
      
      In the NFSv4 case we have long-lived struct files associated with client
      opens, so there's no need for this.  In fact, concurrent IO's using
      trying to modify the same file->f_ra may cause problems.
      
      So, don't bother with the readahead cache in that case.
      
      Note eventually we'll likely do this in the v2/v3 case as well by
      keeping a cache of struct files instead of struct file_ra_state's.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      fa0a2126
  28. 23 7月, 2010 1 次提交
  29. 07 7月, 2010 1 次提交