diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 10:43:51 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 10:43:51 -0700 | 
| commit | 53f2c4a8fd882009a2a75c5b72d6898c0808616e (patch) | |
| tree | 922293a1056c0c2358203cdab832f0e0891e628a /fs/nfs/nfs4filelayoutdev.c | |
| parent | 8f6576ad476b2a22d05ddafd2ddaee102577a4ed (diff) | |
| parent | cc0a98436820b161b595b8cc1d2329bcf7328107 (diff) | |
| download | olio-linux-3.10-53f2c4a8fd882009a2a75c5b72d6898c0808616e.tar.xz olio-linux-3.10-53f2c4a8fd882009a2a75c5b72d6898c0808616e.zip  | |
Merge tag 'nfs-for-3.5-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust:
 "New features include:
   - Rewrite the O_DIRECT code so that it can share the same coalescing
     and pNFS functionality as the page cache code.
   - Allow the server to provide hints as to when we should use pNFS,
     and when it is more efficient to read and write through the
     metadata server.
   - NFS cache consistency updates:
     * Use the ctime to emulate a change attribute for NFSv2/v3 so that
       all NFS versions can share the same cache management code.
     * New cache management code will only look at the change attribute
       and size attribute when deciding whether or not our cached data
       is still valid or not.
     * Don't request NFSv4 post-op attributes on writes in cases such as
       O_DIRECT, where we don't care about data cache consistency, or
       when we have a write delegation, and know that our cache is still
       consistent.
     * Don't request NFSv4 post-op attributes on operations such as
       COMMIT, where there are no expected metadata updates.
     * Don't request NFSv4 directory post-op attributes in cases where
       the operations themselves already return change attribute
       updates: i.e. operations such as OPEN, CREATE, REMOVE, LINK and
       RENAME.
   - Speed up 'ls' and friends by using READDIR rather than READDIRPLUS
     if we detect no attempts to lookup filenames.
   - Improve the code sharing between NFSv2/v3 and v4 mounts
   - NFSv4.1 state management efficiency improvements
   - More patches in preparation for NFSv4/v4.1 migration functionality."
Fix trivial conflict in fs/nfs/nfs4proc.c that was due to the dcache
qstr name initialization changes (that made the length/hash a 64-bit
union)
* tag 'nfs-for-3.5-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (146 commits)
  NFSv4: Add debugging printks to state manager
  NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO
  NFSv4: update_changeattr does not need to set NFS_INO_REVAL_PAGECACHE
  NFSv4.1: nfs4_reset_session should use nfs4_handle_reclaim_lease_error
  NFSv4.1: Handle other occurrences of NFS4ERR_CONN_NOT_BOUND_TO_SESSION
  NFSv4.1: Handle NFS4ERR_CONN_NOT_BOUND_TO_SESSION in the state manager
  NFSv4.1: Handle errors in nfs4_bind_conn_to_session
  NFSv4.1: nfs4_bind_conn_to_session should drain the session
  NFSv4.1: Don't clobber the seqid if exchange_id returns a confirmed clientid
  NFSv4.1: Add DESTROY_CLIENTID
  NFSv4.1: Ensure we use the correct credentials for bind_conn_to_session
  NFSv4.1: Ensure we use the correct credentials for session create/destroy
  NFSv4.1: Move NFSPROC4_CLNT_BIND_CONN_TO_SESSION to the end of the operations
  NFSv4.1: Handle NFS4ERR_SEQ_MISORDERED when confirming the lease
  NFSv4: When purging the lease, we must clear NFS4CLNT_LEASE_CONFIRM
  NFSv4: Clean up the error handling for nfs4_reclaim_lease
  NFSv4.1: Exchange ID must use GFP_NOFS allocation mode
  nfs41: Use BIND_CONN_TO_SESSION for CB_PATH_DOWN*
  nfs4.1: add BIND_CONN_TO_SESSION operation
  NFSv4.1 test the mdsthreshold hint parameters
  ...
Diffstat (limited to 'fs/nfs/nfs4filelayoutdev.c')
| -rw-r--r-- | fs/nfs/nfs4filelayoutdev.c | 102 | 
1 files changed, 51 insertions, 51 deletions
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index c9cff9adb2d..a1fab8da7f0 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c @@ -30,12 +30,16 @@  #include <linux/nfs_fs.h>  #include <linux/vmalloc.h> +#include <linux/module.h>  #include "internal.h"  #include "nfs4filelayout.h"  #define NFSDBG_FACILITY		NFSDBG_PNFS_LD +static unsigned int dataserver_timeo = NFS4_DEF_DS_TIMEO; +static unsigned int dataserver_retrans = NFS4_DEF_DS_RETRANS; +  /*   * Data server cache   * @@ -145,6 +149,28 @@ _data_server_lookup_locked(const struct list_head *dsaddrs)  }  /* + * Lookup DS by nfs_client pointer. Zero data server client pointer + */ +void nfs4_ds_disconnect(struct nfs_client *clp) +{ +	struct nfs4_pnfs_ds *ds; +	struct nfs_client *found = NULL; + +	dprintk("%s clp %p\n", __func__, clp); +	spin_lock(&nfs4_ds_cache_lock); +	list_for_each_entry(ds, &nfs4_data_server_cache, ds_node) +		if (ds->ds_clp && ds->ds_clp == clp) { +			found = ds->ds_clp; +			ds->ds_clp = NULL; +		} +	spin_unlock(&nfs4_ds_cache_lock); +	if (found) { +		set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); +		nfs_put_client(clp); +	} +} + +/*   * Create an rpc connection to the nfs4_pnfs_ds data server   * Currently only supports IPv4 and IPv6 addresses   */ @@ -165,8 +191,9 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)  			__func__, ds->ds_remotestr, da->da_remotestr);  		clp = nfs4_set_ds_client(mds_srv->nfs_client, -				 (struct sockaddr *)&da->da_addr, -				 da->da_addrlen, IPPROTO_TCP); +					(struct sockaddr *)&da->da_addr, +					da->da_addrlen, IPPROTO_TCP, +					dataserver_timeo, dataserver_retrans);  		if (!IS_ERR(clp))  			break;  	} @@ -176,28 +203,7 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)  		goto out;  	} -	if ((clp->cl_exchange_flags & EXCHGID4_FLAG_MASK_PNFS) != 0) { -		if (!is_ds_client(clp)) { -			status = -ENODEV; -			goto out_put; -		} -		ds->ds_clp = clp; -		dprintk("%s [existing] server=%s\n", __func__, -			ds->ds_remotestr); -		goto out; -	} - -	/* -	 * Do not set NFS_CS_CHECK_LEASE_TIME instead set the DS lease to -	 * be equal to the MDS lease. Renewal is scheduled in create_session. -	 */ -	spin_lock(&mds_srv->nfs_client->cl_lock); -	clp->cl_lease_time = mds_srv->nfs_client->cl_lease_time; -	spin_unlock(&mds_srv->nfs_client->cl_lock); -	clp->cl_last_renewal = jiffies; - -	/* New nfs_client */ -	status = nfs4_init_ds_session(clp); +	status = nfs4_init_ds_session(clp, mds_srv->nfs_client->cl_lease_time);  	if (status)  		goto out_put; @@ -602,7 +608,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev, gfp_t gfp_flags)  		mp_count = be32_to_cpup(p); /* multipath count */  		for (j = 0; j < mp_count; j++) { -			da = decode_ds_addr(NFS_SERVER(ino)->nfs_client->net, +			da = decode_ds_addr(NFS_SERVER(ino)->nfs_client->cl_net,  					    &stream, gfp_flags);  			if (da)  				list_add_tail(&da->da_node, &dsaddrs); @@ -791,48 +797,42 @@ nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j)  	return flseg->fh_array[i];  } -static void -filelayout_mark_devid_negative(struct nfs4_file_layout_dsaddr *dsaddr, -			       int err, const char *ds_remotestr) -{ -	u32 *p = (u32 *)&dsaddr->id_node.deviceid; - -	printk(KERN_ERR "NFS: data server %s connection error %d." -		" Deviceid [%x%x%x%x] marked out of use.\n", -		ds_remotestr, err, p[0], p[1], p[2], p[3]); - -	spin_lock(&nfs4_ds_cache_lock); -	dsaddr->flags |= NFS4_DEVICE_ID_NEG_ENTRY; -	spin_unlock(&nfs4_ds_cache_lock); -} -  struct nfs4_pnfs_ds *  nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)  {  	struct nfs4_file_layout_dsaddr *dsaddr = FILELAYOUT_LSEG(lseg)->dsaddr;  	struct nfs4_pnfs_ds *ds = dsaddr->ds_list[ds_idx]; +	struct nfs4_deviceid_node *devid = FILELAYOUT_DEVID_NODE(lseg); + +	if (filelayout_test_devid_invalid(devid)) +		return NULL;  	if (ds == NULL) {  		printk(KERN_ERR "NFS: %s: No data server for offset index %d\n",  			__func__, ds_idx); -		return NULL; +		goto mark_dev_invalid;  	}  	if (!ds->ds_clp) {  		struct nfs_server *s = NFS_SERVER(lseg->pls_layout->plh_inode);  		int err; -		if (dsaddr->flags & NFS4_DEVICE_ID_NEG_ENTRY) { -			/* Already tried to connect, don't try again */ -			dprintk("%s Deviceid marked out of use\n", __func__); -			return NULL; -		}  		err = nfs4_ds_connect(s, ds); -		if (err) { -			filelayout_mark_devid_negative(dsaddr, err, -						       ds->ds_remotestr); -			return NULL; -		} +		if (err) +			goto mark_dev_invalid;  	}  	return ds; + +mark_dev_invalid: +	filelayout_mark_devid_invalid(devid); +	return NULL;  } + +module_param(dataserver_retrans, uint, 0644); +MODULE_PARM_DESC(dataserver_retrans, "The  number of times the NFSv4.1 client " +			"retries a request before it attempts further " +			" recovery  action."); +module_param(dataserver_timeo, uint, 0644); +MODULE_PARM_DESC(dataserver_timeo, "The time (in tenths of a second) the " +			"NFSv4.1  client  waits for a response from a " +			" data server before it retries an NFS request.");  |