Merge branch 'nfsd-next' of git://linux-nfs.org/~bfields/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Nov 2013 20:04:02 +0000 (12:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Nov 2013 20:04:02 +0000 (12:04 -0800)
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
  ...

1  2 
fs/nfsd/nfs4state.c
include/linux/nfs4.h

diff --combined fs/nfsd/nfs4state.c
@@@ -402,11 -402,16 +402,16 @@@ static void remove_stid(struct nfs4_sti
        idr_remove(stateids, s->sc_stateid.si_opaque.so_id);
  }
  
+ static void nfs4_free_stid(struct kmem_cache *slab, struct nfs4_stid *s)
+ {
+       kmem_cache_free(slab, s);
+ }
  void
  nfs4_put_delegation(struct nfs4_delegation *dp)
  {
        if (atomic_dec_and_test(&dp->dl_count)) {
-               kmem_cache_free(deleg_slab, dp);
+               nfs4_free_stid(deleg_slab, &dp->dl_stid);
                num_delegations--;
        }
  }
@@@ -610,7 -615,7 +615,7 @@@ static void close_generic_stateid(struc
  static void free_generic_stateid(struct nfs4_ol_stateid *stp)
  {
        remove_stid(&stp->st_stid);
-       kmem_cache_free(stateid_slab, stp);
+       nfs4_free_stid(stateid_slab, &stp->st_stid);
  }
  
  static void release_lock_stateid(struct nfs4_ol_stateid *stp)
@@@ -668,7 -673,6 +673,6 @@@ static void unhash_open_stateid(struct 
  static void release_open_stateid(struct nfs4_ol_stateid *stp)
  {
        unhash_open_stateid(stp);
-       unhash_stid(&stp->st_stid);
        free_generic_stateid(stp);
  }
  
@@@ -690,7 -694,6 +694,6 @@@ static void release_last_closed_stateid
        struct nfs4_ol_stateid *s = oo->oo_last_closed_stid;
  
        if (s) {
-               unhash_stid(&s->st_stid);
                free_generic_stateid(s);
                oo->oo_last_closed_stid = NULL;
        }
@@@ -1127,6 -1130,11 +1130,11 @@@ destroy_client(struct nfs4_client *clp
                dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
                destroy_delegation(dp);
        }
+       list_splice_init(&clp->cl_revoked, &reaplist);
+       while (!list_empty(&reaplist)) {
+               dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
+               destroy_revoked_delegation(dp);
+       }
        while (!list_empty(&clp->cl_openowners)) {
                oo = list_entry(clp->cl_openowners.next, struct nfs4_openowner, oo_perclient);
                release_openowner(oo);
@@@ -3008,7 -3016,7 +3016,7 @@@ static struct file_lock *nfs4_alloc_ini
                return NULL;
        locks_init_lock(fl);
        fl->fl_lmops = &nfsd_lease_mng_ops;
 -      fl->fl_flags = FL_LEASE;
 +      fl->fl_flags = FL_DELEG;
        fl->fl_type = flag == NFS4_OPEN_DELEGATE_READ? F_RDLCK: F_WRLCK;
        fl->fl_end = OFFSET_MAX;
        fl->fl_owner = (fl_owner_t)(dp->dl_file);
@@@ -3154,7 -3162,7 +3162,7 @@@ nfs4_open_delegation(struct net *net, s
        open->op_delegate_type = NFS4_OPEN_DELEGATE_READ;
        return;
  out_free:
-       unhash_stid(&dp->dl_stid);
+       remove_stid(&dp->dl_stid);
        nfs4_put_delegation(dp);
  out_no_deleg:
        open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;
@@@ -3995,10 -4003,9 +4003,9 @@@ nfsd4_close(struct svc_rqst *rqstp, str
  
        nfsd4_close_open_stateid(stp);
  
-       if (cstate->minorversion) {
-               unhash_stid(&stp->st_stid);
+       if (cstate->minorversion)
                free_generic_stateid(stp);
-       else
+       else
                oo->oo_last_closed_stid = stp;
  
        if (list_empty(&oo->oo_owner.so_stateids)) {
@@@ -5119,7 -5126,6 +5126,6 @@@ out_recovery
        return ret;
  }
  
- /* should be called with the state lock held */
  void
  nfs4_state_shutdown_net(struct net *net)
  {
        cancel_delayed_work_sync(&nn->laundromat_work);
        locks_end_grace(&nn->nfsd4_manager);
  
+       nfs4_lock_state();
        INIT_LIST_HEAD(&reaplist);
        spin_lock(&recall_lock);
        list_for_each_safe(pos, next, &nn->del_recall_lru) {
  
        nfsd4_client_tracking_exit(net);
        nfs4_state_destroy_net(net);
+       nfs4_unlock_state();
  }
  
  void
diff --combined include/linux/nfs4.h
@@@ -118,6 -118,9 +118,9 @@@ Needs to be updated if more operations 
  
  #define FIRST_NFS4_OP OP_ACCESS
  #define LAST_NFS4_OP  OP_RECLAIM_COMPLETE
+ #define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
+ #define LAST_NFS41_OP OP_RECLAIM_COMPLETE
+ #define LAST_NFS42_OP OP_RECLAIM_COMPLETE
  
  enum nfsstat4 {
        NFS4_OK = 0,
@@@ -395,9 -398,7 +398,9 @@@ enum lock_type4 
  #define FATTR4_WORD1_FS_LAYOUT_TYPES    (1UL << 30)
  #define FATTR4_WORD2_LAYOUT_BLKSIZE     (1UL << 1)
  #define FATTR4_WORD2_MDSTHRESHOLD       (1UL << 4)
 -#define FATTR4_WORD2_SECURITY_LABEL     (1UL << 17)
 +#define FATTR4_WORD2_SECURITY_LABEL     (1UL << 16)
 +#define FATTR4_WORD2_CHANGE_SECURITY_LABEL \
 +                                      (1UL << 17)
  
  /* MDS threshold bitmap bits */
  #define THRESHOLD_RD                    (1UL << 0)
@@@ -462,7 -463,6 +465,7 @@@ enum 
        NFSPROC4_CLNT_FS_LOCATIONS,
        NFSPROC4_CLNT_RELEASE_LOCKOWNER,
        NFSPROC4_CLNT_SECINFO,
 +      NFSPROC4_CLNT_FSID_PRESENT,
  
        /* nfs41 */
        NFSPROC4_CLNT_EXCHANGE_ID,