Merge commit 'v2.6.34-rc1' into for-2.6.35-incoming
authorJ. Bruce Fields <bfields@citi.umich.edu>
Tue, 9 Mar 2010 22:22:08 +0000 (17:22 -0500)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Tue, 9 Mar 2010 22:22:08 +0000 (17:22 -0500)
1  2 
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c

diff --combined fs/nfsd/nfs4state.c
@@@ -44,8 -44,8 +44,8 @@@
  #define NFSDDBG_FACILITY                NFSDDBG_PROC
  
  /* Globals */
 -static time_t lease_time = 90;     /* default lease time */
 -static time_t user_lease_time = 90;
 +time_t nfsd4_lease = 90;     /* default lease time */
 +time_t nfsd4_grace = 90;
  static time_t boot_time;
  static u32 current_ownerid = 1;
  static u32 current_fileid = 1;
@@@ -1998,7 -1998,9 +1998,9 @@@ nfs4_file_downgrade(struct file *filp, 
  {
        if (share_access & NFS4_SHARE_ACCESS_WRITE) {
                drop_file_write_access(filp);
+               spin_lock(&filp->f_lock);
                filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE;
+               spin_unlock(&filp->f_lock);
        }
  }
  
@@@ -2551,12 -2553,6 +2553,12 @@@ nfsd4_end_grace(void
        dprintk("NFSD: end of grace period\n");
        nfsd4_recdir_purge_old();
        locks_end_grace(&nfsd4_manager);
 +      /*
 +       * Now that every NFSv4 client has had the chance to recover and
 +       * to see the (possibly new, possibly shorter) lease time, we
 +       * can safely set the next grace time to the current lease time:
 +       */
 +      nfsd4_grace = nfsd4_lease;
  }
  
  static time_t
@@@ -2566,9 -2562,9 +2568,9 @@@ nfs4_laundromat(void
        struct nfs4_stateowner *sop;
        struct nfs4_delegation *dp;
        struct list_head *pos, *next, reaplist;
 -      time_t cutoff = get_seconds() - NFSD_LEASE_TIME;
 -      time_t t, clientid_val = NFSD_LEASE_TIME;
 -      time_t u, test_val = NFSD_LEASE_TIME;
 +      time_t cutoff = get_seconds() - nfsd4_lease;
 +      time_t t, clientid_val = nfsd4_lease;
 +      time_t u, test_val = nfsd4_lease;
  
        nfs4_lock_state();
  
                list_del_init(&dp->dl_recall_lru);
                unhash_delegation(dp);
        }
 -      test_val = NFSD_LEASE_TIME;
 +      test_val = nfsd4_lease;
        list_for_each_safe(pos, next, &close_lru) {
                sop = list_entry(pos, struct nfs4_stateowner, so_close_lru);
                if (time_after((unsigned long)sop->so_time, (unsigned long)cutoff)) {
@@@ -2678,7 -2674,7 +2680,7 @@@ EXPIRED_STATEID(stateid_t *stateid
  {
        if (time_before((unsigned long)boot_time,
                        ((unsigned long)stateid->si_boot)) &&
 -          time_before((unsigned long)(stateid->si_boot + lease_time), get_seconds())) {
 +          time_before((unsigned long)(stateid->si_boot + nfsd4_lease), get_seconds())) {
                dprintk("NFSD: expired stateid " STATEID_FMT "!\n",
                        STATEID_VAL(stateid));
                return 1;
@@@ -3979,6 -3975,12 +3981,6 @@@ nfsd4_load_reboot_recovery_data(void
                printk("NFSD: Failure reading reboot recovery data\n");
  }
  
 -unsigned long
 -get_nfs4_grace_period(void)
 -{
 -      return max(user_lease_time, lease_time) * HZ;
 -}
 -
  /*
   * Since the lifetime of a delegation isn't limited to that of an open, a
   * client may quite reasonably hang on to a delegation as long as it has
@@@ -4005,14 -4007,18 +4007,14 @@@ set_max_delegations(void
  static int
  __nfs4_state_start(void)
  {
 -      unsigned long grace_time;
 -
        boot_time = get_seconds();
 -      grace_time = get_nfs4_grace_period();
 -      lease_time = user_lease_time;
        locks_start_grace(&nfsd4_manager);
        printk(KERN_INFO "NFSD: starting %ld-second grace period\n",
 -             grace_time/HZ);
 +             nfsd4_grace);
        laundry_wq = create_singlethread_workqueue("nfsd4");
        if (laundry_wq == NULL)
                return -ENOMEM;
 -      queue_delayed_work(laundry_wq, &laundromat_work, grace_time);
 +      queue_delayed_work(laundry_wq, &laundromat_work, nfsd4_grace * HZ);
        set_max_delegations();
        return set_callback_cred();
  }
@@@ -4032,6 -4038,12 +4034,6 @@@ nfs4_state_start(void
        return 0;
  }
  
 -time_t
 -nfs4_lease_time(void)
 -{
 -      return lease_time;
 -}
 -
  static void
  __nfs4_state_shutdown(void)
  {
@@@ -4115,3 -4127,21 +4117,3 @@@ nfs4_recoverydir(void
  {
        return user_recovery_dirname;
  }
 -
 -/*
 - * Called when leasetime is changed.
 - *
 - * The only way the protocol gives us to handle on-the-fly lease changes is to
 - * simulate a reboot.  Instead of doing that, we just wait till the next time
 - * we start to register any changes in lease time.  If the administrator
 - * really wants to change the lease time *now*, they can go ahead and bring
 - * nfsd down and then back up again after changing the lease time.
 - *
 - * user_lease_time is protected by nfsd_mutex since it's only really accessed
 - * when nfsd is starting
 - */
 -void
 -nfs4_reset_lease(time_t leasetime)
 -{
 -      user_lease_time = leasetime;
 -}
diff --combined fs/nfsd/nfs4xdr.c
@@@ -1899,7 -1899,7 +1899,7 @@@ nfsd4_encode_fattr(struct svc_fh *fhp, 
        if (bmval0 & FATTR4_WORD0_LEASE_TIME) {
                if ((buflen -= 4) < 0)
                        goto out_resource;
 -              WRITE32(NFSD_LEASE_TIME);
 +              WRITE32(nfsd4_lease);
        }
        if (bmval0 & FATTR4_WORD0_RDATTR_ERROR) {
                if ((buflen -= 4) < 0)
@@@ -2121,9 -2121,15 +2121,15 @@@ out_acl
                 * and this is the root of a cross-mounted filesystem.
                 */
                if (ignore_crossmnt == 0 &&
-                   exp->ex_path.mnt->mnt_root->d_inode == dentry->d_inode) {
-                       err = vfs_getattr(exp->ex_path.mnt->mnt_parent,
-                               exp->ex_path.mnt->mnt_mountpoint, &stat);
+                   dentry == exp->ex_path.mnt->mnt_root) {
+                       struct path path = exp->ex_path;
+                       path_get(&path);
+                       while (follow_up(&path)) {
+                               if (path.dentry != path.mnt->mnt_root)
+                                       break;
+                       }
+                       err = vfs_getattr(path.mnt, path.dentry, &stat);
+                       path_put(&path);
                        if (err)
                                goto out_nfserr;
                }