Skip to content

Commit 28890d3

Browse files
committed
Merge branch 'nfs-for-3.1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
* 'nfs-for-3.1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (44 commits) NFSv4: Don't use the delegation->inode in nfs_mark_return_delegation() nfs: don't use d_move in nfs_async_rename_done RDMA: Increasing RPCRDMA_MAX_DATA_SEGS SUNRPC: Replace xprt->resend and xprt->sending with a priority queue SUNRPC: Allow caller of rpc_sleep_on() to select priority levels SUNRPC: Support dynamic slot allocation for TCP connections SUNRPC: Clean up the slot table allocation SUNRPC: Initalise the struct xprt upon allocation SUNRPC: Ensure that we grab the XPRT_LOCK before calling xprt_alloc_slot pnfs: simplify pnfs files module autoloading nfs: document nfsv4 sillyrename issues NFS: Convert nfs4_set_ds_client to EXPORT_SYMBOL_GPL SUNRPC: Convert the backchannel exports to EXPORT_SYMBOL_GPL SUNRPC: sunrpc should not explicitly depend on NFS config options NFS: Clean up - simplify the switch to read/write-through-MDS NFS: Move the pnfs write code into pnfs.c NFS: Move the pnfs read code into pnfs.c NFS: Allow the nfs_pageio_descriptor to signal that a re-coalesce is needed NFS: Use the nfs_pageio_descriptor->pg_bsize in the read/write request NFS: Cache rpc_ops in struct nfs_pageio_descriptor ...
2 parents 91d41fd + ed1e621 commit 28890d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1856
-632
lines changed

fs/lockd/clntproc.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ nlmclnt_call(struct rpc_cred *cred, struct nlm_rqst *req, u32 proc)
302302
/* We appear to be out of the grace period */
303303
wake_up_all(&host->h_gracewait);
304304
}
305-
dprintk("lockd: server returns status %d\n", resp->status);
305+
dprintk("lockd: server returns status %d\n",
306+
ntohl(resp->status));
306307
return 0; /* Okay, call complete */
307308
}
308309

@@ -690,7 +691,8 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
690691
goto out;
691692

692693
if (resp->status != nlm_lck_denied_nolocks)
693-
printk("lockd: unexpected unlock status: %d\n", resp->status);
694+
printk("lockd: unexpected unlock status: %d\n",
695+
ntohl(resp->status));
694696
/* What to do now? I'm out of my depth... */
695697
status = -ENOLCK;
696698
out:
@@ -843,6 +845,7 @@ nlm_stat_to_errno(__be32 status)
843845
return -ENOLCK;
844846
#endif
845847
}
846-
printk(KERN_NOTICE "lockd: unexpected server status %d\n", status);
848+
printk(KERN_NOTICE "lockd: unexpected server status %d\n",
849+
ntohl(status));
847850
return -ENOLCK;
848851
}

fs/nfs/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ config NFS_V4
7777
config NFS_V4_1
7878
bool "NFS client support for NFSv4.1 (EXPERIMENTAL)"
7979
depends on NFS_FS && NFS_V4 && EXPERIMENTAL
80+
select SUNRPC_BACKCHANNEL
8081
select PNFS_FILE_LAYOUT
8182
help
8283
This option enables support for minor version 1 of the NFSv4 protocol

fs/nfs/callback_proc.c

+36-21
Original file line numberDiff line numberDiff line change
@@ -111,28 +111,36 @@ int nfs4_validate_delegation_stateid(struct nfs_delegation *delegation, const nf
111111
static u32 initiate_file_draining(struct nfs_client *clp,
112112
struct cb_layoutrecallargs *args)
113113
{
114+
struct nfs_server *server;
114115
struct pnfs_layout_hdr *lo;
115116
struct inode *ino;
116117
bool found = false;
117118
u32 rv = NFS4ERR_NOMATCHING_LAYOUT;
118119
LIST_HEAD(free_me_list);
119120

120121
spin_lock(&clp->cl_lock);
121-
list_for_each_entry(lo, &clp->cl_layouts, plh_layouts) {
122-
if (nfs_compare_fh(&args->cbl_fh,
123-
&NFS_I(lo->plh_inode)->fh))
124-
continue;
125-
ino = igrab(lo->plh_inode);
126-
if (!ino)
127-
continue;
128-
found = true;
129-
/* Without this, layout can be freed as soon
130-
* as we release cl_lock.
131-
*/
132-
get_layout_hdr(lo);
133-
break;
122+
rcu_read_lock();
123+
list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
124+
list_for_each_entry(lo, &server->layouts, plh_layouts) {
125+
if (nfs_compare_fh(&args->cbl_fh,
126+
&NFS_I(lo->plh_inode)->fh))
127+
continue;
128+
ino = igrab(lo->plh_inode);
129+
if (!ino)
130+
continue;
131+
found = true;
132+
/* Without this, layout can be freed as soon
133+
* as we release cl_lock.
134+
*/
135+
get_layout_hdr(lo);
136+
break;
137+
}
138+
if (found)
139+
break;
134140
}
141+
rcu_read_unlock();
135142
spin_unlock(&clp->cl_lock);
143+
136144
if (!found)
137145
return NFS4ERR_NOMATCHING_LAYOUT;
138146

@@ -154,6 +162,7 @@ static u32 initiate_file_draining(struct nfs_client *clp,
154162
static u32 initiate_bulk_draining(struct nfs_client *clp,
155163
struct cb_layoutrecallargs *args)
156164
{
165+
struct nfs_server *server;
157166
struct pnfs_layout_hdr *lo;
158167
struct inode *ino;
159168
u32 rv = NFS4ERR_NOMATCHING_LAYOUT;
@@ -167,18 +176,24 @@ static u32 initiate_bulk_draining(struct nfs_client *clp,
167176
};
168177

169178
spin_lock(&clp->cl_lock);
170-
list_for_each_entry(lo, &clp->cl_layouts, plh_layouts) {
179+
rcu_read_lock();
180+
list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
171181
if ((args->cbl_recall_type == RETURN_FSID) &&
172-
memcmp(&NFS_SERVER(lo->plh_inode)->fsid,
173-
&args->cbl_fsid, sizeof(struct nfs_fsid)))
174-
continue;
175-
if (!igrab(lo->plh_inode))
182+
memcmp(&server->fsid, &args->cbl_fsid,
183+
sizeof(struct nfs_fsid)))
176184
continue;
177-
get_layout_hdr(lo);
178-
BUG_ON(!list_empty(&lo->plh_bulk_recall));
179-
list_add(&lo->plh_bulk_recall, &recall_list);
185+
186+
list_for_each_entry(lo, &server->layouts, plh_layouts) {
187+
if (!igrab(lo->plh_inode))
188+
continue;
189+
get_layout_hdr(lo);
190+
BUG_ON(!list_empty(&lo->plh_bulk_recall));
191+
list_add(&lo->plh_bulk_recall, &recall_list);
192+
}
180193
}
194+
rcu_read_unlock();
181195
spin_unlock(&clp->cl_lock);
196+
182197
list_for_each_entry_safe(lo, tmp,
183198
&recall_list, plh_bulk_recall) {
184199
ino = lo->plh_inode;

fs/nfs/client.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
188188
cred = rpc_lookup_machine_cred();
189189
if (!IS_ERR(cred))
190190
clp->cl_machine_cred = cred;
191-
#if defined(CONFIG_NFS_V4_1)
192-
INIT_LIST_HEAD(&clp->cl_layouts);
193-
#endif
194191
nfs_fscache_get_client_cookie(clp);
195192

196193
return clp;
@@ -293,6 +290,7 @@ static void nfs_free_client(struct nfs_client *clp)
293290
nfs4_deviceid_purge_client(clp);
294291

295292
kfree(clp->cl_hostname);
293+
kfree(clp->server_scope);
296294
kfree(clp);
297295

298296
dprintk("<-- nfs_free_client()\n");
@@ -1062,6 +1060,7 @@ static struct nfs_server *nfs_alloc_server(void)
10621060
INIT_LIST_HEAD(&server->client_link);
10631061
INIT_LIST_HEAD(&server->master_link);
10641062
INIT_LIST_HEAD(&server->delegations);
1063+
INIT_LIST_HEAD(&server->layouts);
10651064

10661065
atomic_set(&server->active, 0);
10671066

@@ -1464,7 +1463,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
14641463
dprintk("<-- %s %p\n", __func__, clp);
14651464
return clp;
14661465
}
1467-
EXPORT_SYMBOL(nfs4_set_ds_client);
1466+
EXPORT_SYMBOL_GPL(nfs4_set_ds_client);
14681467

14691468
/*
14701469
* Session has been established, and the client marked ready.

fs/nfs/delegation.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,11 @@ int nfs_inode_return_delegation(struct inode *inode)
398398
return err;
399399
}
400400

401-
static void nfs_mark_return_delegation(struct nfs_delegation *delegation)
401+
static void nfs_mark_return_delegation(struct nfs_server *server,
402+
struct nfs_delegation *delegation)
402403
{
403-
struct nfs_client *clp = NFS_SERVER(delegation->inode)->nfs_client;
404-
405404
set_bit(NFS_DELEGATION_RETURN, &delegation->flags);
406-
set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state);
405+
set_bit(NFS4CLNT_DELEGRETURN, &server->nfs_client->cl_state);
407406
}
408407

409408
/**
@@ -441,7 +440,7 @@ static void nfs_mark_return_all_delegation_types(struct nfs_server *server,
441440
if ((delegation->type == (FMODE_READ|FMODE_WRITE)) && !(flags & FMODE_WRITE))
442441
continue;
443442
if (delegation->type & flags)
444-
nfs_mark_return_delegation(delegation);
443+
nfs_mark_return_delegation(server, delegation);
445444
}
446445
}
447446

@@ -508,7 +507,7 @@ static void nfs_mark_return_unreferenced_delegations(struct nfs_server *server)
508507
list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
509508
if (test_and_clear_bit(NFS_DELEGATION_REFERENCED, &delegation->flags))
510509
continue;
511-
nfs_mark_return_delegation(delegation);
510+
nfs_mark_return_delegation(server, delegation);
512511
}
513512
}
514513

@@ -539,7 +538,8 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp)
539538
int nfs_async_inode_return_delegation(struct inode *inode,
540539
const nfs4_stateid *stateid)
541540
{
542-
struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
541+
struct nfs_server *server = NFS_SERVER(inode);
542+
struct nfs_client *clp = server->nfs_client;
543543
struct nfs_delegation *delegation;
544544

545545
rcu_read_lock();
@@ -549,7 +549,7 @@ int nfs_async_inode_return_delegation(struct inode *inode,
549549
rcu_read_unlock();
550550
return -ENOENT;
551551
}
552-
nfs_mark_return_delegation(delegation);
552+
nfs_mark_return_delegation(server, delegation);
553553
rcu_read_unlock();
554554

555555
nfs_delegation_run_state_manager(clp);

fs/nfs/internal.h

+13
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ extern void nfs_sb_deactive(struct super_block *sb);
277277
extern char *nfs_path(char **p, struct dentry *dentry,
278278
char *buffer, ssize_t buflen);
279279
extern struct vfsmount *nfs_d_automount(struct path *path);
280+
#ifdef CONFIG_NFS_V4
281+
rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *);
282+
#endif
280283

281284
/* getroot.c */
282285
extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *,
@@ -288,12 +291,22 @@ extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *,
288291
extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh);
289292
#endif
290293

294+
struct nfs_pageio_descriptor;
291295
/* read.c */
292296
extern int nfs_initiate_read(struct nfs_read_data *data, struct rpc_clnt *clnt,
293297
const struct rpc_call_ops *call_ops);
294298
extern void nfs_read_prepare(struct rpc_task *task, void *calldata);
299+
extern int nfs_generic_pagein(struct nfs_pageio_descriptor *desc,
300+
struct list_head *head);
301+
302+
extern void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio);
303+
extern void nfs_readdata_release(struct nfs_read_data *rdata);
295304

296305
/* write.c */
306+
extern int nfs_generic_flush(struct nfs_pageio_descriptor *desc,
307+
struct list_head *head);
308+
extern void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio);
309+
extern void nfs_writedata_release(struct nfs_write_data *wdata);
297310
extern void nfs_commit_free(struct nfs_write_data *p);
298311
extern int nfs_initiate_write(struct nfs_write_data *data,
299312
struct rpc_clnt *clnt,

fs/nfs/namespace.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
119119
}
120120

121121
#ifdef CONFIG_NFS_V4
122-
static rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors)
122+
rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors)
123123
{
124124
struct gss_api_mech *mech;
125125
struct xdr_netobj oid;

fs/nfs/nfs4_fs.h

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ enum nfs4_client_state {
4848
NFS4CLNT_SESSION_RESET,
4949
NFS4CLNT_RECALL_SLOT,
5050
NFS4CLNT_LEASE_CONFIRM,
51+
NFS4CLNT_SERVER_SCOPE_MISMATCH,
5152
};
5253

5354
enum nfs4_session_state {
@@ -66,6 +67,8 @@ struct nfs4_minor_version_ops {
6667
int cache_reply);
6768
int (*validate_stateid)(struct nfs_delegation *,
6869
const nfs4_stateid *);
70+
int (*find_root_sec)(struct nfs_server *, struct nfs_fh *,
71+
struct nfs_fsinfo *);
6972
const struct nfs4_state_recovery_ops *reboot_recovery_ops;
7073
const struct nfs4_state_recovery_ops *nograce_recovery_ops;
7174
const struct nfs4_state_maintenance_ops *state_renewal_ops;
@@ -349,6 +352,8 @@ extern void nfs4_schedule_state_manager(struct nfs_client *);
349352
extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *);
350353
extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags);
351354
extern void nfs41_handle_recall_slot(struct nfs_client *clp);
355+
extern void nfs41_handle_server_scope(struct nfs_client *,
356+
struct server_scope **);
352357
extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
353358
extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
354359
extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t, pid_t);

0 commit comments

Comments
 (0)