summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* SUNRPC: Add rpcauth_list_flavors()Chuck Lever2012-07-166-9/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The gss_mech_list_pseudoflavors() function provides a list of currently registered GSS pseudoflavors. This list does not include any non-GSS flavors that have been registered with the RPC client. nfs4_find_root_sec() currently adds these extra flavors by hand. Instead, nfs4_find_root_sec() should be looking at the set of flavors that have been explicitly registered via rpcauth_register(). And, other areas of code will soon need the same kind of list that contains all flavors the kernel currently knows about (see below). Rather than cloning the open-coded logic in nfs4_find_root_sec() to those new places, introduce a generic RPC function that generates a full list of registered auth flavors and pseudoflavors. A new rpc_authops method is added that lists a flavor's pseudoflavors, if it has any. I encountered an interesting module loader loop when I tried to get the RPC client to invoke gss_mech_list_pseudoflavors() by name. This patch is a pre-requisite for server trunking discovery, and a pre-requisite for fixing up the in-kernel mount client to do better automatic security flavor selection. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: nfs_getaclargs.acl_len is a size_tChuck Lever2012-07-161-1/+2
| | | | | | | | | | | | | | | | Squelch compiler warnings: fs/nfs/nfs4proc.c: In function ‘__nfs4_get_acl_uncached’: fs/nfs/nfs4proc.c:3811:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] fs/nfs/nfs4proc.c:3818:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Introduced by commit bf118a34 "NFSv4: include bitmap in nfsv4 get acl data", Dec 7, 2011. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Clean up TEST_STATEID and FREE_STATEID error reportingChuck Lever2012-07-161-2/+29
| | | | | | | | As a finishing touch, add appropriate documenting comments and some debugging printk's. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Clean up nfs41_check_expired_stateid()Chuck Lever2012-07-161-16/+61
| | | | | | | | | | | | | Clean up: Instead of open-coded flag manipulation, use test_bit() and clear_bit() just like all other accessors of the state->flag field. This also eliminates several unnecessary implicit integer type conversions. To make it absolutely clear what is going on, a number of comments are introduced. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: State reclaim clears OPEN and LOCK stateChuck Lever2012-07-161-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The "state->flags & flags" test in nfs41_check_expired_stateid() allows the state manager to squelch a TEST_STATEID operation when it is known for sure that a state ID is no longer valid. If the lease was purged, for example, the client already knows that state ID is now defunct. But open recovery is still needed for that inode. To force a call to nfs4_open_expired(), change the default return value for nfs41_check_expired_stateid() to force open recovery, and the default return value for nfs41_check_locks() to force lock recovery, if the requested flags are clear. Fix suggested by Bryan Schumaker. Also, the presence of a delegation state ID must not prevent normal open recovery. The delegation state ID must be cleared if it was revoked, but once cleared I don't think it's presence or absence has any bearing on whether open recovery is still needed. So the logic is adjusted to ignore the TEST_STATEID result for the delegation state ID. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Don't free a state ID the server does not recognizeChuck Lever2012-07-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | The result of a TEST_STATEID operation can indicate a few different things: o If NFS_OK is returned, then the client can continue using the state ID under test, and skip recovery. o RFC 5661 says that if the state ID was revoked, then the client must perform an explicit FREE_STATEID before trying to re-open. o If the server doesn't recognize the state ID at all, then no FREE_STATEID is needed, and the client can immediately continue with open recovery. Let's err on the side of caution: if the server clearly tells us the state ID is unknown, we skip the FREE_STATEID. For any other error, we issue a FREE_STATEID. Sometimes that FREE_STATEID will be unnecessary, but leaving unused state IDs on the server needlessly ties up resources. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFS: Fix up TEST_STATEID and FREE_STATEID return code handlingChuck Lever2012-07-161-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TEST_STATEID and FREE_STATEID operations can return -NFS4ERR_BAD_STATEID, -NFS4ERR_OLD_STATEID, or -NFS4ERR_DEADSESSION. nfs41_{test,free}_stateid() should not pass these errors to nfs4_handle_exception() during state recovery, since that will recursively kick off state recovery again, resulting in a deadlock. In particular, when the TEST_STATEID operation returns NFS4_OK, res.status can contain one of these errors. _nfs41_test_stateid() replaces NFS4_OK with the value in res.status, which is then returned to callers. But res.status is not passed through nfs4_stat_to_errno(), and thus is a positive NFS4ERR value. Currently callers are only interested in !NFS4_OK, and nfs4_handle_exception() ignores positive values. Thus the res.status values are currently ignored by nfs4_handle_exception() and won't cause the deadlock above. Thanks to this missing negative, it is only when these operations fail (which is very rare) that a deadlock can occur. Bryan agrees the original intent was to return res.status as a negative NFS4ERR value to callers of nfs41_test_stateid(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFSv4.1 do not send LAYOUTRETURN on emtpy plh_segs listAndy Adamson2012-07-161-4/+19
| | | | | | | | | | | | mark_matching_lsegs_invalid() resets the mds_threshold counters and can dereference the layout hdr on an initial empty plh_segs list. It returns 0 both in the case of an initial empty list and in a non-emtpy list that was cleared by calls to mark_lseg_invalid. Don't send a LAYOUTRETURN if the list was initially empty. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFSv4.1 mark layout when already returnedAndy Adamson2012-07-162-2/+27
| | | | | | | | | | | | When the file layout driver is fencing a DS, _pnfs_return_layout can be called mulitple times per inode due to in-flight i/o referencing lsegs on it's plh_segs list. Remember that LAYOUTRETURN has been called, and do not call it again. Allow LAYOUTRETURNs after a subsequent LAYOUTGET. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFSv4.1 don't send LAYOUTCOMMIT if data resent through MDSAndy Adamson2012-07-161-0/+1
| | | | | Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* NFSv4.1 return the LAYOUT for each file with failed DS connection I/OAndy Adamson2012-07-161-2/+1Star
| | | | | | | | | First mark the deviceid invalid to prevent any future use. Then fence all files involved in I/O to a DS with a connection error by sending a LAYOUTRETURN. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
* Merge commit '9249e17fe094d853d1ef7475dd559a2cc7e23d42' into nfs-for-3.6Trond Myklebust2012-07-16698-4493/+6388
|\ | | | | | | | | | | | | Resolve conflicts with the VFS atomic open and sget changes. Conflicts: fs/nfs/nfs4proc.c
| * VFS: Pass mount flags to sget()David Howells2012-07-1420-50/+40Star
| | | | | | | | | | | | | | | | | | Pass mount flags to sget() so that it can use them in initialising a new superblock before the set function is called. They could also be passed to the compare function. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * VFS: Comment mount following codeDavid Howells2012-07-142-2/+24
| | | | | | | | | | | | | | | | | | Add comments describing what the directions "up" and "down" mean and ref count handling to the VFS mount following family of functions. Signed-off-by: Valerie Aurora <vaurora@redhat.com> (Original author) Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * VFS: Make clone_mnt()/copy_tree()/collect_mounts() return errorsDavid Howells2012-07-143-62/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | copy_tree() can theoretically fail in a case other than ENOMEM, but always returns NULL which is interpreted by callers as -ENOMEM. Change it to return an explicit error. Also change clone_mnt() for consistency and because union mounts will add new error cases. Thanks to Andreas Gruenbacher <agruen@suse.de> for a bug fix. [AV: folded braino fix by Dan Carpenter] Original-author: Valerie Aurora <vaurora@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com> Cc: Valerie Aurora <valerie.aurora@gmail.com> Cc: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * VFS: Make chown() and lchown() call fchownat()David Howells2012-07-141-34/+7Star
| | | | | | | | | | | | | | | | Make the chown() and lchown() syscalls jump to the fchownat() syscall with the appropriate extra arguments. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * do_dentry_open(): close the race with mark_files_ro() in failure exitAl Viro2012-07-141-1/+1
| | | | | | | | | | | | | | we want to take it out of mark_files_ro() reach *before* we start checking if we ought to drop write access. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * mark_files_ro(): don't bother with mntget/mntputAl Viro2012-07-141-8/+1Star
| | | | | | | | | | | | mnt_drop_write_file() is safe under any lock Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * notify_change(): check that i_mutex is heldAndrew Morton2012-07-141-1/+2
| | | | | | | | | | | | | | Cc: Djalal Harouni <tixxdz@opendz.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: add nd_jump_linkChristoph Hellwig2012-07-143-12/+20
| | | | | | | | | | | | | | | | | | | | Add a helper that abstracts out the jump to an already parsed struct path from ->follow_link operation from procfs. Not only does this clean up the code by moving the two sides of this game into a single helper, but it also prepares for making struct nameidata private to namei.c Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: move path_put on failure out of ->follow_linkChristoph Hellwig2012-07-142-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | Currently the non-nd_set_link based versions of ->follow_link are expected to do a path_put(&nd->path) on failure. This calling convention is unexpected, undocumented and doesn't match what the nd_set_link-based instances do. Move the path_put out of the only non-nd_set_link based ->follow_link instance into the caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * debugfs: get rid of useless arguments to debugfs_{mkdir,symlink}Al Viro2012-07-141-11/+9Star
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * debugfs: fold debugfs_create_by_name() into the only callerAl Viro2012-07-141-33/+20Star
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * debugfs: make sure that debugfs_create_file() gets used only for regularsAl Viro2012-07-141-22/+34
| | | | | | | | | | | | | | It, debugfs_create_dir() and debugfs_create_link() use the common helper now. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * __d_unalias() should refuse to move mountpointsAl Viro2012-07-141-4/+5
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * sysfs: just use d_materialise_unique()Al Viro2012-07-141-8/+1Star
| | | | | | | | | | | | same as for nfs et.al. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * sysfs: switch to ->s_d_op and ->d_release()Al Viro2012-07-143-10/+8Star
| | | | | | | | | | | | | | | | | | a) ->d_iput() is wrong here - what we do to inode is completely usual, it's dentry->d_fsdata that we want to drop. Just use ->d_release(). b) switch to ->s_d_op - no need to play with d_set_d_op() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * get rid of kern_path_parent()Al Viro2012-07-144-82/+65Star
| | | | | | | | | | | | | | | | | | all callers want the same thing, actually - a kinda-sorta analog of kern_path_create(). I.e. they want parent vfsmount/dentry (with ->i_mutex held, to make sure the child dentry is still their child) + the child dentry. Signed-off-by Al Viro <viro@zeniv.linux.org.uk>
| * VFS: Fix the banner comment on lookup_open()David Howells2012-07-141-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | Since commit 197e37d9, the banner comment on lookup_open() no longer matches what the function returns. It used to return a struct file pointer or NULL and now it returns an integer and is passed the struct file pointer it is to use amongst its arguments. Update the comment to reflect this. Also add a banner comment to atomic_open(). Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * don't pass nameidata * to vfs_create()Al Viro2012-07-146-10/+11
| | | | | | | | | | | | all we want is a boolean flag, same as the method gets now Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * don't pass nameidata to ->create()Al Viro2012-07-1451-64/+62Star
| | | | | | | | | | | | | | | | boolean "does it have to be exclusive?" flag is passed instead; Local filesystem should just ignore it - the object is guaranteed not to be there yet. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/namei.c: don't pass nameidata to __lookup_hash() and lookup_real()Al Viro2012-07-141-10/+10
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * stop passing nameidata to ->lookup()Al Viro2012-07-1479-114/+115
| | | | | | | | | | | | | | | | | | Just the flags; only NFS cares even about that, but there are legitimate uses for such argument. And getting rid of that completely would require splitting ->lookup() into a couple of methods (at least), so let's leave that alone for now... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/namei.c: don't pass namedata to lookup_dcache()Al Viro2012-07-141-4/+4
| | | | | | | | | | | | just the flags... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/namei.c: don't pass nameidata to d_revalidate()Al Viro2012-07-141-6/+6
| | | | | | | | | | | | since the method wrapped by it doesn't need that anymore... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * stop passing nameidata * to ->d_revalidate()Al Viro2012-07-1425-84/+74Star
| | | | | | | | | | | | Just the lookup flags. Die, bastard, die... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/nfs/dir.c: switch to passing nd->flags instead of nd wherever possibleAl Viro2012-07-141-32/+19Star
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * nfs_lookup_verify_inode() - nd is *always* non-NULL hereAl Viro2012-07-141-13/+10Star
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch nfs_lookup_check_intent() away from nameidataAl Viro2012-07-141-5/+5
| | | | | | | | | | | | just pass the flags Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * do_dentry_open(): take initialization of file->f_path to callerAl Viro2012-07-141-14/+12Star
| | | | | | | | | | | | | | ... and get rid of a couple of arguments and a pointless reassignment in finish_open() case. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fold __dentry_open() into its sole callerAl Viro2012-07-141-21/+12Star
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * switch do_dentry_open() to returning intAl Viro2012-07-141-20/+20
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * make finish_no_open() return intAl Viro2012-07-148-20/+12Star
| | | | | | | | | | | | | | namely, 1 ;-) That's what we want to return from ->atomic_open() instances after finish_no_open(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs/namei.c: get do_last() and friends return intAl Viro2012-07-141-80/+70Star
| | | | | | | | | | | | | | Same conventions as for ->atomic_open(). Trimmed the forest of labels a bit, while we are at it... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * kill struct opendataAl Viro2012-07-1415-98/+81Star
| | | | | | | | | | | | | | | | | | Just pass struct file *. Methods are happier that way... There's no need to return struct file * from finish_open() now, so let it return int. Next: saner prototypes for parts in namei.c Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * kill opendata->{mnt,dentry}Al Viro2012-07-143-14/+9Star
| | | | | | | | | | | | ->filp->f_path is there for purpose... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * make ->atomic_open() return intAl Viro2012-07-1413-105/+97Star
| | | | | | | | | | | | | | | | | | | | | | | | Change of calling conventions: old new NULL 1 file 0 ERR_PTR(-ve) -ve Caller *knows* that struct file *; no need to return it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * don't modify od->filp at allAl Viro2012-07-142-6/+3Star
| | | | | | | | | | | | make put_filp() conditional on flag set by finish_open() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ->atomic_open() prototype change - pass int * instead of bool *Al Viro2012-07-1414-52/+63
| | | | | | | | | | | | | | | | | | ... and let finish_open() report having opened the file via that sucker. Next step: don't modify od->filp at all. [AV: FILE_CREATE was already used by cifs; Miklos' fix folded] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * vfs: move O_DIRECT check to common codeMiklos Szeredi2012-07-141-12/+5Star
| | | | | | | | | | | | | | | | Perform open_check_o_direct() in a common place in do_last after opening the file. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>