Skip to content

Commit bd81cce

Browse files
committed
Merge branch 'for-3.7' of git://linux-nfs.org/~bfields/linux
Pull nfsd update from J Bruce Fields: "Another relatively quiet cycle. There was some progress on my remaining 4.1 todo's, but a couple of them were just of the form "check that we do X correctly", so didn't have much affect on the code. Other than that, a bunch of cleanup and some bugfixes (including an annoying NFSv4.0 state leak and a busy-loop in the server that could cause it to peg the CPU without making progress)." * 'for-3.7' of git://linux-nfs.org/~bfields/linux: (46 commits) UAPI: (Scripted) Disintegrate include/linux/sunrpc UAPI: (Scripted) Disintegrate include/linux/nfsd nfsd4: don't allow reclaims of expired clients nfsd4: remove redundant callback probe nfsd4: expire old client earlier nfsd4: separate session allocation and initialization nfsd4: clean up session allocation nfsd4: minor free_session cleanup nfsd4: new_conn_from_crses should only allocate nfsd4: separate connection allocation and initialization nfsd4: reject bad forechannel attrs earlier nfsd4: enforce per-client sessions/no-sessions distinction nfsd4: set cl_minorversion at create time nfsd4: don't pin clientids to pseudoflavors nfsd4: fix bind_conn_to_session xdr comment nfsd4: cast readlink() bug argument NFSD: pass null terminated buf to kstrtouint() nfsd: remove duplicate init in nfsd4_cb_recall nfsd4: eliminate redundant nfs4_free_stateid fs/nfsd/nfs4idmap.c: adjust inconsistent IS_ERR and PTR_ERR ...
2 parents 98260da + a9ca404 commit bd81cce

36 files changed

+756
-757
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Administrative interfaces for nfsd
2+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+
Note that normally these interfaces are used only by the utilities in
5+
nfs-utils.
6+
7+
nfsd is controlled mainly by pseudofiles under the "nfsd" filesystem,
8+
which is normally mounted at /proc/fs/nfsd/.
9+
10+
The server is always started by the first write of a nonzero value to
11+
nfsd/threads.
12+
13+
Before doing that, NFSD can be told which sockets to listen on by
14+
writing to nfsd/portlist; that write may be:
15+
16+
- an ascii-encoded file descriptor, which should refer to a
17+
bound (and listening, for tcp) socket, or
18+
- "transportname port", where transportname is currently either
19+
"udp", "tcp", or "rdma".
20+
21+
If nfsd is started without doing any of these, then it will create one
22+
udp and one tcp listener at port 2049 (see nfsd_init_socks).
23+
24+
On startup, nfsd and lockd grace periods start.
25+
26+
nfsd is shut down by a write of 0 to nfsd/threads. All locks and state
27+
are thrown away at that point.
28+
29+
Between startup and shutdown, the number of threads may be adjusted up
30+
or down by additional writes to nfsd/threads or by writes to
31+
nfsd/pool_threads.
32+
33+
For more detail about files under nfsd/ and what they control, see
34+
fs/nfsd/nfsctl.c; most of them have detailed comments.
35+
36+
Implementation notes
37+
^^^^^^^^^^^^^^^^^^^^
38+
39+
Note that the rpc server requires the caller to serialize addition and
40+
removal of listening sockets, and startup and shutdown of the server.
41+
For nfsd this is done using nfsd_mutex.

fs/lockd/svc.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void restart_grace(void)
126126
static int
127127
lockd(void *vrqstp)
128128
{
129-
int err = 0, preverr = 0;
129+
int err = 0;
130130
struct svc_rqst *rqstp = vrqstp;
131131

132132
/* try_to_freeze() is called from svc_recv() */
@@ -165,21 +165,8 @@ lockd(void *vrqstp)
165165
* recvfrom routine.
166166
*/
167167
err = svc_recv(rqstp, timeout);
168-
if (err == -EAGAIN || err == -EINTR) {
169-
preverr = err;
168+
if (err == -EAGAIN || err == -EINTR)
170169
continue;
171-
}
172-
if (err < 0) {
173-
if (err != preverr) {
174-
printk(KERN_WARNING "%s: unexpected error "
175-
"from svc_recv (%d)\n", __func__, err);
176-
preverr = err;
177-
}
178-
schedule_timeout_interruptible(HZ);
179-
continue;
180-
}
181-
preverr = err;
182-
183170
dprintk("lockd: request from %s\n",
184171
svc_print_addr(rqstp, buf, sizeof(buf)));
185172

fs/locks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ EXPORT_SYMBOL(__break_lease);
12891289
void lease_get_mtime(struct inode *inode, struct timespec *time)
12901290
{
12911291
struct file_lock *flock = inode->i_flock;
1292-
if (flock && IS_LEASE(flock) && (flock->fl_type & F_WRLCK))
1292+
if (flock && IS_LEASE(flock) && (flock->fl_type == F_WRLCK))
12931293
*time = current_fs_time(inode->i_sb);
12941294
else
12951295
*time = inode->i_mtime;
@@ -2185,8 +2185,8 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
21852185
} else {
21862186
seq_printf(f, "%s ",
21872187
(lease_breaking(fl))
2188-
? (fl->fl_type & F_UNLCK) ? "UNLCK" : "READ "
2189-
: (fl->fl_type & F_WRLCK) ? "WRITE" : "READ ");
2188+
? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ "
2189+
: (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
21902190
}
21912191
if (inode) {
21922192
#ifdef WE_CAN_BREAK_LSLK_NOW

fs/nfs/callback.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static int nfs4_callback_up_net(struct svc_serv *serv, struct net *net)
7272
static int
7373
nfs4_callback_svc(void *vrqstp)
7474
{
75-
int err, preverr = 0;
75+
int err;
7676
struct svc_rqst *rqstp = vrqstp;
7777

7878
set_freezable();
@@ -82,20 +82,8 @@ nfs4_callback_svc(void *vrqstp)
8282
* Listen for a request on the socket
8383
*/
8484
err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT);
85-
if (err == -EAGAIN || err == -EINTR) {
86-
preverr = err;
85+
if (err == -EAGAIN || err == -EINTR)
8786
continue;
88-
}
89-
if (err < 0) {
90-
if (err != preverr) {
91-
printk(KERN_WARNING "NFS: %s: unexpected error "
92-
"from svc_recv (%d)\n", __func__, err);
93-
preverr = err;
94-
}
95-
schedule_timeout_uninterruptible(HZ);
96-
continue;
97-
}
98-
preverr = err;
9987
svc_process(rqstp);
10088
}
10189
return 0;

fs/nfsd/nfs2acl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
218218
* There must be an encoding function for void results so svc_process
219219
* will work properly.
220220
*/
221-
int
222-
nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
221+
static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy)
223222
{
224223
return xdr_ressize_check(rqstp, p);
225224
}

fs/nfsd/nfs3proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
247247
/* Now create the file and set attributes */
248248
nfserr = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len,
249249
attr, newfhp,
250-
argp->createmode, argp->verf, NULL, NULL);
250+
argp->createmode, (u32 *)argp->verf, NULL, NULL);
251251

252252
RETURN_STATUS(nfserr);
253253
}

fs/nfsd/nfs4callback.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,6 @@ void nfsd4_cb_recall(struct nfs4_delegation *dp)
10281028
cb->cb_msg.rpc_cred = callback_cred;
10291029

10301030
cb->cb_ops = &nfsd4_cb_recall_ops;
1031-
dp->dl_retries = 1;
10321031

10331032
INIT_LIST_HEAD(&cb->cb_per_client);
10341033
cb->cb_done = true;

fs/nfsd/nfs4idmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ nfsd_idmap_init(struct net *net)
478478
goto destroy_idtoname_cache;
479479
nn->nametoid_cache = cache_create_net(&nametoid_cache_template, net);
480480
if (IS_ERR(nn->nametoid_cache)) {
481-
rv = PTR_ERR(nn->idtoname_cache);
481+
rv = PTR_ERR(nn->nametoid_cache);
482482
goto unregister_idtoname_cache;
483483
}
484484
rv = cache_register_net(nn->nametoid_cache, net);
@@ -598,7 +598,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel
598598
/* Just to make sure it's null-terminated: */
599599
memcpy(buf, name, namelen);
600600
buf[namelen] = '\0';
601-
ret = kstrtouint(name, 10, id);
601+
ret = kstrtouint(buf, 10, id);
602602
return ret == 0;
603603
}
604604

fs/nfsd/nfs4proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
370370
break;
371371
case NFS4_OPEN_CLAIM_PREVIOUS:
372372
open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
373-
status = nfs4_check_open_reclaim(&open->op_clientid);
373+
status = nfs4_check_open_reclaim(&open->op_clientid, cstate->minorversion);
374374
if (status)
375375
goto out;
376376
case NFS4_OPEN_CLAIM_FH:
@@ -1054,8 +1054,8 @@ struct nfsd4_operation {
10541054
char *op_name;
10551055
/* Try to get response size before operation */
10561056
nfsd4op_rsize op_rsize_bop;
1057-
stateid_setter op_get_currentstateid;
1058-
stateid_getter op_set_currentstateid;
1057+
stateid_getter op_get_currentstateid;
1058+
stateid_setter op_set_currentstateid;
10591059
};
10601060

10611061
static struct nfsd4_operation nfsd4_ops[];

0 commit comments

Comments
 (0)