Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 153654
b: refs/heads/master
c: 0b7c2f6
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Apr 28, 2009
1 parent c1208cb commit 50b217b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82d565919aa4138bc481a7473491b71385af4018
refs/heads/master: 0b7c2f6fc7e06867885c7b0f256ff5bd494e0653
64 changes: 34 additions & 30 deletions trunk/fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,37 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
return rv;
}

/*
* A single 'fd' number was written, in which case it must be for
* a socket of a supported family/protocol, and we use it as an
* nfsd listener.
*/
static ssize_t __write_ports_addfd(char *buf)
{
char *mesg = buf;
int fd, err;

err = get_int(&mesg, &fd);
if (err != 0 || fd < 0)
return -EINVAL;

err = nfsd_create_serv();
if (err != 0)
return err;

err = svc_addsock(nfsd_serv, fd, buf);
if (err >= 0) {
err = lockd_up();
if (err < 0)
svc_sock_names(buf + strlen(buf) + 1, nfsd_serv, buf);

/* Decrease the count, but don't shut down the service */
nfsd_serv->sv_nrthreads--;
}

return err < 0 ? err : 0;
}

/*
* A '-' followed by the 'name' of a socket means we close the socket.
*/
Expand Down Expand Up @@ -995,36 +1026,9 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size)
len = svc_xprt_names(nfsd_serv, buf, 0);
return len;
}
/* Either a single 'fd' number is written, in which
* case it must be for a socket of a supported family/protocol,
* and we use it as an nfsd socket, or
* A '-' followed by the 'name' of a socket in which case
* we close the socket.
*/
if (isdigit(buf[0])) {
char *mesg = buf;
int fd;
int err;
err = get_int(&mesg, &fd);
if (err)
return -EINVAL;
if (fd < 0)
return -EINVAL;
err = nfsd_create_serv();
if (!err) {
err = svc_addsock(nfsd_serv, fd, buf);
if (err >= 0) {
err = lockd_up();
if (err < 0)
svc_sock_names(buf+strlen(buf)+1, nfsd_serv, buf);
}
/* Decrease the count, but don't shutdown the
* the service
*/
nfsd_serv->sv_nrthreads--;
}
return err < 0 ? err : 0;
}

if (isdigit(buf[0]))
return __write_ports_addfd(buf);

if (buf[0] == '-' && isdigit(buf[1]))
return __write_ports_delfd(buf);
Expand Down

0 comments on commit 50b217b

Please sign in to comment.