summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
Commit message (Collapse)AuthorAgeFilesLines
* nfsd: fix lost nfserrno() call in nfsd_setattr()J. R. Okajima2014-02-181-0/+1
| | | | | | | | | There is a regression in 208d0ac 2014-01-07 nfsd4: break only delegations when appropriate which deletes an nfserrno() call in nfsd_setattr() (by accident, probably), and NFSD becomes ignoring an error from VFS. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix acl buffer overrunJ. Bruce Fields2014-02-111-6/+3
| | | | | | | | | | | | 4ac7249ea5a0ceef9f8269f63f33cc873c3fac61 "nfsd: use get_acl and ->set_acl" forgets to set the size in the case get_acl() succeeds, so _posix_to_nfsv4_one() can then write past the end of its allocation. Symptoms were slab corruption warnings. Also, some minor cleanup while we're here. (Among other things, note that the first few lines guarantee that pacl is non-NULL.) Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* Merge branch 'for-3.14' of git://linux-nfs.org/~bfields/linuxLinus Torvalds2014-01-3017-272/+219
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull nfsd updates from Bruce Fields: - Handle some loose ends from the vfs read delegation support. (For example nfsd can stop breaking leases on its own in a fewer places where it can now depend on the vfs to.) - Make life a little easier for NFSv4-only configurations (thanks to Kinglong Mee). - Fix some gss-proxy problems (thanks Jeff Layton). - miscellaneous bug fixes and cleanup * 'for-3.14' of git://linux-nfs.org/~bfields/linux: (38 commits) nfsd: consider CLAIM_FH when handing out delegation nfsd4: fix delegation-unlink/rename race nfsd4: delay setting current_fh in open nfsd4: minor nfs4_setlease cleanup gss_krb5: use lcm from kernel lib nfsd4: decrease nfsd4_encode_fattr stack usage nfsd: fix encode_entryplus_baggage stack usage nfsd4: simplify xdr encoding of nfsv4 names nfsd4: encode_rdattr_error cleanup nfsd4: nfsd4_encode_fattr cleanup minor svcauth_gss.c cleanup nfsd4: better VERIFY comment nfsd4: break only delegations when appropriate NFSD: Fix a memory leak in nfsd4_create_session sunrpc: get rid of use_gssp_lock sunrpc: fix potential race between setting use_gss_proxy and the upcall rpc_clnt sunrpc: don't wait for write before allowing reads from use-gss-proxy file nfsd: get rid of unused function definition Define op_iattr for nfsd4_open instead using macro NFSD: fix compile warning without CONFIG_NFSD_V3 ...
| * nfsd: consider CLAIM_FH when handing out delegationMing Chen2014-01-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CLAIM_FH was added by NFSv4.1. It is the same as CLAIM_NULL except that it uses only current FH to identify the file to be opened. The NFS client is using CLAIM_FH if the FH is available when opening a file. Currently, we cannot get any delegation if we stat a file before open it because the server delegation code does not recognize CLAIM_FH. We tested this patch and found delegation can be handed out now when claim is CLAIM_FH. See http://marc.info/?l=linux-nfs&m=136369847801388&w=2 and http://www.linux-nfs.org/wiki/index.php/Server_4.0_and_4.1_issues#New_open_claim_types Signed-off-by: Ming Chen <mchen@cs.stonybrook.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: fix delegation-unlink/rename raceJ. Bruce Fields2014-01-272-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a file is unlinked or renamed between the time when we do the local open and the time when we get the delegation, then we will return to the client indicating that it holds a delegation even though the file no longer exists under the name it was open under. But a client performing an open-by-name, when it is returned a delegation, must be able to assume that the file is still linked at the name it was opened under. So, hold the parent i_mutex for longer to prevent concurrent renames or unlinks. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: delay setting current_fh in openJ. Bruce Fields2014-01-271-17/+20
| | | | | | | | | | | | | | This is basically a no-op, to simplify a following patch. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: minor nfs4_setlease cleanupJ. Bruce Fields2014-01-271-6/+6
| | | | | | | | | | | | | | | | As far as I can tell, this list is used only under the state lock, so we may as well do this in the simpler order. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: decrease nfsd4_encode_fattr stack usageJ. Bruce Fields2014-01-241-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | A struct svc_fh is 320 bytes on x86_64, it'd be better not to have these on the stack. kmalloc'ing them probably isn't ideal either, but this is the simplest thing to do. If it turns out to be a problem in the readdir case then we could add a svc_fh to nfsd4_readdir and pass that in. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: fix encode_entryplus_baggage stack usageJ. Bruce Fields2014-01-232-6/+9
| | | | | | | | | | | | | | | | We stick an extra svc_fh in nfsd3_readdirres to save the need to kmalloc, though maybe it would be fine to kmalloc instead. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: simplify xdr encoding of nfsv4 namesJ. Bruce Fields2014-01-085-73/+55
| | | | | | | | | | | | | | We can simplify the idmapping code if it does its own encoding and returns nfs errors. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: encode_rdattr_error cleanupJ. Bruce Fields2014-01-071-4/+1
| | | | | | | | | | | | There's a simpler way to write this. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: nfsd4_encode_fattr cleanupJ. Bruce Fields2014-01-071-13/+4
| | | | | | | | | | | | Remove some pointless goto's. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: better VERIFY commentJ. Bruce Fields2014-01-071-2/+4
| | | | | | | | | | | | This confuses me every time. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: break only delegations when appropriateJ. Bruce Fields2014-01-071-30/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a temporary fix, nfsd was breaking all leases on unlink, link, rename, and setattr. Now that we can distinguish between leases and delegations, we can be nicer and break only the delegations, and not bother lease-holders with operations they don't care about. And we get to delete some code while we're at it. Note that in the presence of delegations the vfs calls here all return -EWOULDBLOCK instead of blocking, so nfsd threads will not get stuck waiting for delegation returns. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: Fix a memory leak in nfsd4_create_sessionKinglong Mee2014-01-061-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | If failed after calling alloc_session but before init_session, nfsd will call __free_session to free se_slots in session. But, session->se_fchannel.maxreqs is not initialized (value is zero). So that, the memory malloced for slots will be lost in free_session_slots for maxreqs is zero. This path sets the information for channel in alloc_session after mallocing slots succeed, instead in init_session. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: get rid of unused function definitionKinglong Mee2014-01-061-2/+0
| | | | | | | | | | Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * Define op_iattr for nfsd4_open instead using macroKinglong Mee2014-01-061-2/+1
| | | | | | | | | | Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: fix compile warning without CONFIG_NFSD_V3Kinglong Mee2014-01-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Without CONFIG_NFSD_V3, compile will get warning as, fs/nfsd/nfssvc.c: In function 'nfsd_svc': >> fs/nfsd/nfssvc.c:246:60: warning: array subscript is above array bounds [-Warray-bounds] return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL); ^ Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: Don't start lockd when only NFSv4 is runningKinglong Mee2014-01-032-5/+22
| | | | | | | | | | | | | | | | | | | | | | When starting without nfsv2 and nfsv3, nfsd does not need to start lockd (and certainly doesn't need to fail because lockd failed to register with the portmapper). Reported-by: Gareth Williams <gareth@garethwilliams.me.uk> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * SUNRPC/NFSD: Support a new option for ignoring the result of svc_registerKinglong Mee2014-01-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NFSv4 clients can contact port 2049 directly instead of needing the portmapper. Therefore a failure to register to the portmapper when starting an NFSv4-only server isn't really a problem. But Gareth Williams reports that an attempt to start an NFSv4-only server without starting portmap fails: #rpc.nfsd -N 2 -N 3 rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused) rpc.nfsd: unable to set any sockets for nfsd Add a flag to svc_version to tell the rpc layer it can safely ignore an rpcbind failure in the NFSv4-only case. Reported-by: Gareth Williams <gareth@garethwilliams.me.uk> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: fix bad length checking for backchannelKinglong Mee2014-01-031-2/+7
| | | | | | | | | | | | | | the length for backchannel checking should be multiplied by sizeof(__be32). Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: fix a leak which can cause CREATE_SESSION failuresKinglong Mee2014-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | check_forechannel_attrs gets drc memory, so nfsd must put it when check_backchannel_attrs fails. After many requests with bad back channel attrs, nfsd will deny any client's CREATE_SESSION forever. A new test case named CSESS29 for pynfs will send in another mail. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * Add missing recording of back channel attrs in nfsd4_sessionKinglong Mee2014-01-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | commit 5b6feee9608dce7afd2646f457c93e612526d1d8 forgot recording the back channel attrs in nfsd4_session. nfsd just check the back channel attars by check_backchannel_attrs, but do not record it in nfsd4_session in the latest kernel. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: get rid of unused macro definitionKinglong Mee2014-01-031-5/+0
| | | | | | | | | | | | | | Since defined in Linux-2.6.12-rc2, READTIME has not been used. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: clean up unnecessary temporary variable in nfsd4_decode_fattrKinglong Mee2014-01-031-9/+3
| | | | | | | | | | | | | | | | host_err was only used for nfs4_acl_new. This patch delete it, and return nfserr_jukebox directly. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: using nfsd4_encode_noop for encoding destroy_session/free_stateidKinglong Mee2014-01-032-25/+2
| | | | | | | | | | | | | | | | Get rid of the extra code, using nfsd4_encode_noop for encoding destroy_session and free_stateid. And, delete unused argument (fr_status) int nfsd4_free_stateid. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: clean up an xdr reserved space calculationKinglong Mee2014-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | We should use XDR_LEN to calculate reserved space in case the oid is not a multiple of 4. RESERVE_SPACE actually rounds up for us, but it's probably better to be careful here. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: get rid of unused function definitionKinglong Mee2014-01-021-8/+0
| | | | | | | | | | | | | | | | | | commit 557ce2646e775f6bda734dd92b10d4780874b9c7 "nfsd41: replace page based DRC with buffer based DRC" have remove unused nfsd4_set_statp, but miss the function definition. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: calculate the missing length of bitmap in EXCHANGE_IDKinglong Mee2014-01-022-9/+18
| | | | | | | | | | | | | | | | | | commit 58cd57bfd9db3bc213bf9d6a10920f82095f0114 "nfsd: Fix SP4_MACH_CRED negotiation in EXCHANGE_ID" miss calculating the length of bitmap for spo_must_enforce and spo_must_allow. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: revoking of suid/sgid bits after chown() in a consistent wayStanislav Kholmanskikh2013-12-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an inconsistency in the handling of SUID/SGID file bits after chown() between NFS and other local file systems. Local file systems (for example, ext3, ext4, xfs, btrfs) revoke SUID/SGID bits after chown() on a regular file even if the owner/group of the file has not been changed: ~# touch file; chmod ug+s file; chmod u+x file ~# ls -l file -rwsr-Sr-- 1 root root 0 Dec 6 04:49 file ~# chown root file; ls -l file -rwxr-Sr-- 1 root root 0 Dec 6 04:49 file but NFS doesn't do that: ~# touch file; chmod ug+s file; chmod u+x file ~# ls -l file -rwsr-Sr-- 1 root root 0 Dec 6 04:49 file ~# chown root file; ls -l file -rwsr-Sr-- 1 root root 0 Dec 6 04:49 file NFS does that only if the owner/group has been changed: ~# touch file; chmod ug+s file; chmod u+x file ~# ls -l file -rwsr-Sr-- 1 root root 0 Dec 6 05:02 file ~# chown bin file; ls -l file -rwxr-Sr-- 1 bin root 0 Dec 6 05:02 file See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html "If the specified file is a regular file, one or more of the S_IXUSR, S_IXGRP, or S_IXOTH bits of the file mode are set, and the process has appropriate privileges, it is implementation-defined whether the set-user-ID and set-group-ID bits are altered." So both variants are acceptable by POSIX. This patch makes NFS to behave like local file systems. Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: don't try to reuse an expired DRC entry off the listJeff Layton2013-12-111-32/+4
| | | | | | | | | | | | | | | | | | | | | | Currently when we are processing a request, we try to scrape an expired or over-limit entry off the list in preference to allocating a new one from the slab. This is unnecessarily complicated. Just use the slab layer. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: start documenting some XDR handling functionsChristoph Hellwig2013-12-101-0/+19
| | | | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: don't return high mode bitsAlbert Fluegel2013-12-102-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux NFS server replies among other things to a "Check access permission" the following: NFS: File type = 2 (Directory) NFS: Mode = 040755 A netapp server replies here: NFS: File type = 2 (Directory) NFS: Mode = 0755 The RFC 1813 i read: fattr3 struct fattr3 { ftype3 type; mode3 mode; uint32 nlink; ... For the mode bits only the lowest 9 are defined in the RFC As far as I can tell, knfsd has always done this, so apparently it's harmless. Nevertheless, it appears to be wrong. Note this is already correct in the NFSv4 case, only v2 and v3 need fixing. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* | nfsd: use get_acl and ->set_aclChristoph Hellwig2014-01-267-347/+173
|/ | | | | | | | | Remove the boilerplate code to marshall and unmarhall ACL objects into xattrs and operate on the posix_acl objects directly. Also move all the ACL handling code into nfs?acl.c where it belongs. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* nfsd: when reusing an existing repcache entry, unhash it firstJeff Layton2013-12-101-1/+8
| | | | | | | | | | | | | | | | | | | | | | | The DRC code will attempt to reuse an existing, expired cache entry in preference to allocating a new one. It'll then search the cache, and if it gets a hit it'll then free the cache entry that it was going to reuse. The cache code doesn't unhash the entry that it's going to reuse however, so it's possible for it end up designating an entry for reuse and then subsequently freeing the same entry after it finds it. This leads it to a later use-after-free situation and usually some list corruption warnings or an oops. Fix this by simply unhashing the entry that we intend to reuse. That will mean that it's not findable via a search and should prevent this situation from occurring. Cc: stable@vger.kernel.org # v3.10+ Reported-by: Christoph Hellwig <hch@infradead.org> Reported-by: g. artim <gartim@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd4: fix xdr decoding of large non-write compoundsJ. Bruce Fields2013-11-191-1/+2
| | | | | | | | | | | | | | | | | This fixes a regression from 247500820ebd02ad87525db5d9b199e5b66f6636 "nfsd4: fix decoding of compounds across page boundaries". The previous code was correct: argp->pagelist is initialized in nfs4svc_deocde_compoundargs to rqstp->rq_arg.pages, and is therefore a pointer to the page *after* the page we are currently decoding. The reason that patch nevertheless fixed a problem with decoding compounds containing write was a bug in the write decoding introduced by 5a80a54d21c96590d013378d8c5f65f879451ab4 "nfsd4: reorganize write decoding", after which write decoding no longer adhered to the rule that argp->pagelist point to the next page. Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: make sure to balance get/put_write_accessChristoph Hellwig2013-11-181-14/+15
| | | | | | | | | | | | | | Use a straight goto error label style in nfsd_setattr to make sure we always do the put_write_access call after we got it earlier. Note that the we have been failing to do that in the case nfsd_break_lease() returns an error, a bug introduced into 2.6.38 with 6a76bebefe15d9a08864f824d7f8d5beaf37c997 "nfsd4: break lease on nfsd setattr". Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* nfsd: split up nfsd_setattrChristoph Hellwig2013-11-181-60/+84
| | | | | | | | | Split out two helpers to make the code more readable and easier to verify for correctness. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
* Merge branch 'nfsd-next' of git://linux-nfs.org/~bfields/linuxLinus Torvalds2013-11-165-77/+115
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull nfsd changes from Bruce Fields: "This includes miscellaneous bugfixes and cleanup and a performance fix for write-heavy NFSv4 workloads. (The most significant nfsd-relevant change this time is actually in the delegation patches that went through Viro, fixing a long-standing bug that can cause NFSv4 clients to miss updates made by non-nfs users of the filesystem. Those enable some followup nfsd patches which I have queued locally, but those can wait till 3.14)" * 'nfsd-next' of git://linux-nfs.org/~bfields/linux: (24 commits) nfsd: export proper maximum file size to the client nfsd4: improve write performance with better sendspace reservations svcrpc: remove an unnecessary assignment sunrpc: comment typo fix Revert "nfsd: remove_stid can be incorporated into nfs4_put_delegation" nfsd4: fix discarded security labels on setattr NFSD: Add support for NFS v4.2 operation checking nfsd4: nfsd_shutdown_net needs state lock NFSD: Combine decode operations for v4 and v4.1 nfsd: -EINVAL on invalid anonuid/gid instead of silent failure nfsd: return better errors to exportfs nfsd: fh_update should error out in unexpected cases nfsd4: need to destroy revoked delegations in destroy_client nfsd: no need to unhash_stid before free nfsd: remove_stid can be incorporated into nfs4_put_delegation nfsd: nfs4_open_delegation needs to remove_stid rather than unhash_stid nfsd: nfs4_free_stid nfsd: fix Kconfig syntax sunrpc: trim off EC bytes in GSSAPI v2 unwrap gss_krb5: document that we ignore sequence number ...
| * nfsd: export proper maximum file size to the clientChristoph Hellwig2013-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | I noticed that we export a way to high value for the maxfilesize attribute when debugging a client issue. The issue didn't turn out to be related to it, but I think we should export it, so that clients can limit what write sizes they accept before hitting the server. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: improve write performance with better sendspace reservationsJ. Bruce Fields2013-11-131-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the rpc code conservatively refuses to accept rpc's from a client if the sum of its worst-case estimates of the replies it owes that client exceed the send buffer space. Unfortunately our estimate of the worst-case reply for an NFSv4 compound is always the maximum read size. This can unnecessarily limit the number of operations we handle concurrently, for example in the case most operations are writes (which have small replies). We can do a little better if we check which ops the compound contains. This is still a rough estimate, we'll need to improve on it some day. Reported-by: Shyam Kaushik <shyamnfs1@gmail.com> Tested-by: Shyam Kaushik <shyamnfs1@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * Revert "nfsd: remove_stid can be incorporated into nfs4_put_delegation"J. Bruce Fields2013-11-041-1/+3
| | | | | | | | | | | | | | | | | | This reverts commit 7ebe40f20372688a627ad6c754bc0d1c05df58a9. We forgot the nfs4_put_delegation call in fs/nfsd/nfs4callback.c which should not be unhashing the stateid. This lead to warnings from the idr code when we tried to removed id's twice. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: fix discarded security labels on setattrJ. Bruce Fields2013-11-011-0/+1
| | | | | | | | | | | | | | | | | | Security labels in setattr calls are currently ignored because we forget to set label->len. Cc: stable@vger.kernel.org Reported-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: Add support for NFS v4.2 operation checkingAnna Schumaker2013-10-301-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | The server does allow NFS over v4.2, even if it doesn't add any new operations yet. I also switch to using constants to represent the last operation for each minor version since this makes the code cleaner and easier to understand at a quick glance. Signed-off-by: Anna Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: nfsd_shutdown_net needs state lockJ. Bruce Fields2013-10-301-1/+2
| | | | | | | | | | | | | | | | | | A comment claims the caller should take it, but that's not being done. Note we don't want it around the cancel_delayed_work_sync since that may wait on work which holds the client lock. Reported-by: Benny Halevy <bhalevy@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * NFSD: Combine decode operations for v4 and v4.1Anna Schumaker2013-10-301-58/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | We were using a different array of function pointers to represent each minor version. This makes adding a new minor version tedious, since it needs a step to copy, paste and modify a new version of the same functions. This patch combines the v4 and v4.1 arrays into a single instance and will check minor version support inside each decoder function. Signed-off-by: Anna Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: -EINVAL on invalid anonuid/gid instead of silent failureJ. Bruce Fields2013-10-291-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're going to refuse to accept these it would be polite of us to at least say so.... This introduces a slight complication since we need to grandfather in exportfs's ill-advised use of -1 uid and gid on its test_export. If it turns out there are other users passing down -1 we may need to do something else. Best might be to drop the checks entirely, but I'm not sure if other parts of the kernel might assume that a task can't run as uid or gid -1. Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: return better errors to exportfsJ. Bruce Fields2013-10-291-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Someone noticed exportfs happily accepted exports that would later be rejected when mountd tried to give them to the kernel. Fix this. This is a regression from 4c1e1b34d5c800ad3ac9a7e2805b0bea70ad2278 "nfsd: Store ex_anon_uid and ex_anon_gid as kuids and kgids". Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: stable@vger.kernel.org Reported-by: Yin.JianHong <jiyin@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd: fh_update should error out in unexpected casesJ. Bruce Fields2013-10-291-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reporter saw a NULL dereference when a filesystem's ->mknod returned success but left the dentry negative, and then nfsd tried to dereference d_inode (in this case because the CREATE was followed by a GETATTR in the same nfsv4 compound). fh_update already checks for this and another broken case, but for some reason it returns success and leaves nfsd trying to soldier on. If it failed we'd avoid the crash. There's only so much we can do with a buggy filesystem, but it's easy enough to bail out here, so let's do that. Reported-by: Antti Tönkyrä <daedalus@pingtimeout.net> Tested-by: Antti Tönkyrä <daedalus@pingtimeout.net> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| * nfsd4: need to destroy revoked delegations in destroy_clientBenny Halevy2013-10-291-0/+5
| | | | | | | | | | | | | | [use list_splice_init] Signed-off-by: Benny Halevy <bhalevy@primarydata.com> [bfields: no need for recall_lock here] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
OpenPOWER on IntegriCloud