Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68793
b: refs/heads/master
c: 13626cb
h: refs/heads/master
i:
  68791: 02c1549
v: v3
  • Loading branch information
Linus Torvalds committed Oct 15, 2007
1 parent e4d73b0 commit 1a0b1c0
Show file tree
Hide file tree
Showing 21 changed files with 351 additions and 392 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: ace3dff5b7f0bf5a647e60dcd0c0a7d46792f5d9
refs/heads/master: 13626cb91f41df803c54047172bfc7a716e36c2b
1 change: 0 additions & 1 deletion trunk/arch/powerpc/platforms/ps3/system-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ static void ps3_system_bus_shutdown(struct device *_dev)
static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *env)
{
struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
int i = 0, length = 0;

if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id))
return -ENOMEM;
Expand Down
12 changes: 9 additions & 3 deletions trunk/drivers/hid/hidraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,15 @@ static int hidraw_ioctl(struct inode *inode, struct file *file, unsigned int cmd

if (get_user(len, (int __user *)arg))
return -EFAULT;
if (copy_to_user(*((__u8 **)(user_arg +
sizeof(__u32))),
dev->hid->rdesc, len))

if (len > HID_MAX_DESCRIPTOR_SIZE - 1)
return -EINVAL;

if (copy_to_user(user_arg + offsetof(
struct hidraw_report_descriptor,
value[0]),
dev->hid->rdesc,
min(dev->hid->rsize, len)))
return -EFAULT;
return 0;
}
Expand Down
59 changes: 27 additions & 32 deletions trunk/fs/nfsd/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ static __be32 *
encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
struct kstat *stat)
{
struct dentry *dentry = fhp->fh_dentry;
struct timespec time;

*p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
*p++ = htonl((u32) stat->mode);
*p++ = htonl((u32) stat->nlink);
Expand All @@ -191,10 +188,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
*p++ = htonl((u32) MAJOR(stat->rdev));
*p++ = htonl((u32) MINOR(stat->rdev));
p = encode_fsid(p, fhp);
p = xdr_encode_hyper(p, (u64) stat->ino);
p = xdr_encode_hyper(p, stat->ino);
p = encode_time3(p, &stat->atime);
lease_get_mtime(dentry->d_inode, &time);
p = encode_time3(p, &time);
p = encode_time3(p, &stat->mtime);
p = encode_time3(p, &stat->ctime);

return p;
Expand All @@ -203,31 +199,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
static __be32 *
encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
{
struct inode *inode = fhp->fh_dentry->d_inode;

/* Attributes to follow */
*p++ = xdr_one;

*p++ = htonl(nfs3_ftypes[(fhp->fh_post_mode & S_IFMT) >> 12]);
*p++ = htonl((u32) fhp->fh_post_mode);
*p++ = htonl((u32) fhp->fh_post_nlink);
*p++ = htonl((u32) nfsd_ruid(rqstp, fhp->fh_post_uid));
*p++ = htonl((u32) nfsd_rgid(rqstp, fhp->fh_post_gid));
if (S_ISLNK(fhp->fh_post_mode) && fhp->fh_post_size > NFS3_MAXPATHLEN) {
p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
} else {
p = xdr_encode_hyper(p, (u64) fhp->fh_post_size);
}
p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9);
*p++ = fhp->fh_post_rdev[0];
*p++ = fhp->fh_post_rdev[1];
p = encode_fsid(p, fhp);
p = xdr_encode_hyper(p, (u64) inode->i_ino);
p = encode_time3(p, &fhp->fh_post_atime);
p = encode_time3(p, &fhp->fh_post_mtime);
p = encode_time3(p, &fhp->fh_post_ctime);

return p;
return encode_fattr3(rqstp, p, fhp, &fhp->fh_post_attr);
}

/*
Expand All @@ -246,6 +220,7 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat);
if (!err) {
*p++ = xdr_one; /* attributes follow */
lease_get_mtime(dentry->d_inode, &stat.mtime);
return encode_fattr3(rqstp, p, fhp, &stat);
}
}
Expand Down Expand Up @@ -284,6 +259,23 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
return encode_post_op_attr(rqstp, p, fhp);
}

/*
* Fill in the post_op attr for the wcc data
*/
void fill_post_wcc(struct svc_fh *fhp)
{
int err;

if (fhp->fh_post_saved)
printk("nfsd: inode locked twice during operation.\n");

err = vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry,
&fhp->fh_post_attr);
if (err)
fhp->fh_post_saved = 0;
else
fhp->fh_post_saved = 1;
}

/*
* XDR decode functions
Expand Down Expand Up @@ -643,8 +635,11 @@ int
nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_attrstat *resp)
{
if (resp->status == 0)
if (resp->status == 0) {
lease_get_mtime(resp->fh.fh_dentry->d_inode,
&resp->stat.mtime);
p = encode_fattr3(rqstp, p, &resp->fh, &resp->stat);
}
return xdr_ressize_check(rqstp, p);
}

Expand Down Expand Up @@ -802,7 +797,7 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p,

static __be32 *
encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
int namlen, ino_t ino)
int namlen, u64 ino)
{
*p++ = xdr_one; /* mark entry present */
p = xdr_encode_hyper(p, ino); /* file id */
Expand Down Expand Up @@ -873,7 +868,7 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
#define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2))
static int
encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
loff_t offset, ino_t ino, unsigned int d_type, int plus)
loff_t offset, u64 ino, unsigned int d_type, int plus)
{
struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
common);
Expand Down
89 changes: 27 additions & 62 deletions trunk/fs/nfsd/nfs4callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/clnt.h>
Expand Down Expand Up @@ -343,26 +344,28 @@ static struct rpc_version * nfs_cb_version[] = {
&nfs_cb_version4,
};

/*
* Use the SETCLIENTID credential
*/
static struct rpc_cred *
nfsd4_lookupcred(struct nfs4_client *clp, int taskflags)
/* Reference counting, callback cleanup, etc., all look racy as heck.
* And why is cb_set an atomic? */

static int do_probe_callback(void *data)
{
struct auth_cred acred;
struct rpc_clnt *clnt = clp->cl_callback.cb_client;
struct rpc_cred *ret;

get_group_info(clp->cl_cred.cr_group_info);
acred.uid = clp->cl_cred.cr_uid;
acred.gid = clp->cl_cred.cr_gid;
acred.group_info = clp->cl_cred.cr_group_info;

dprintk("NFSD: looking up %s cred\n",
clnt->cl_auth->au_ops->au_name);
ret = rpcauth_lookup_credcache(clnt->cl_auth, &acred, taskflags);
put_group_info(clp->cl_cred.cr_group_info);
return ret;
struct nfs4_client *clp = data;
struct nfs4_callback *cb = &clp->cl_callback;
struct rpc_message msg = {
.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
.rpc_argp = clp,
};
int status;

status = rpc_call_sync(cb->cb_client, &msg, RPC_TASK_SOFT);

if (status) {
rpc_shutdown_client(cb->cb_client);
cb->cb_client = NULL;
} else
atomic_set(&cb->cb_set, 1);
put_nfs4_client(clp);
return 0;
}

/*
Expand Down Expand Up @@ -390,11 +393,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
.authflavor = RPC_AUTH_UNIX, /* XXX: need AUTH_GSS... */
.flags = (RPC_CLNT_CREATE_NOPING),
};
struct rpc_message msg = {
.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL],
.rpc_argp = clp,
};
int status;
struct task_struct *t;

if (atomic_read(&cb->cb_set))
return;
Expand Down Expand Up @@ -426,16 +425,11 @@ nfsd4_probe_callback(struct nfs4_client *clp)
/* the task holds a reference to the nfs4_client struct */
atomic_inc(&clp->cl_count);

msg.rpc_cred = nfsd4_lookupcred(clp,0);
if (IS_ERR(msg.rpc_cred))
goto out_release_clp;
status = rpc_call_async(cb->cb_client, &msg, RPC_TASK_ASYNC, &nfs4_cb_null_ops, NULL);
put_rpccred(msg.rpc_cred);
t = kthread_run(do_probe_callback, clp, "nfs4_cb_probe");

if (status != 0) {
dprintk("NFSD: asynchronous NFSPROC4_CB_NULL failed!\n");
if (IS_ERR(t))
goto out_release_clp;
}

return;

out_release_clp:
Expand All @@ -447,30 +441,6 @@ nfsd4_probe_callback(struct nfs4_client *clp)
(int)clp->cl_name.len, clp->cl_name.data);
}

static void
nfs4_cb_null(struct rpc_task *task, void *dummy)
{
struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp;
struct nfs4_callback *cb = &clp->cl_callback;
__be32 addr = htonl(cb->cb_addr);

dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status);

if (task->tk_status < 0) {
dprintk("NFSD: callback establishment to client %.*s failed\n",
(int)clp->cl_name.len, clp->cl_name.data);
goto out;
}
atomic_set(&cb->cb_set, 1);
dprintk("NFSD: callback set to client %u.%u.%u.%u\n", NIPQUAD(addr));
out:
put_nfs4_client(clp);
}

static const struct rpc_call_ops nfs4_cb_null_ops = {
.rpc_call_done = nfs4_cb_null,
};

/*
* called with dp->dl_count inc'ed.
* nfs4_lock_state() may or may not have been called.
Expand All @@ -491,10 +461,6 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
if ((!atomic_read(&clp->cl_callback.cb_set)) || !clnt)
return;

msg.rpc_cred = nfsd4_lookupcred(clp, 0);
if (IS_ERR(msg.rpc_cred))
goto out;

cbr->cbr_trunc = 0; /* XXX need to implement truncate optimization */
cbr->cbr_dp = dp;

Expand All @@ -515,13 +481,12 @@ nfsd4_cb_recall(struct nfs4_delegation *dp)
status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFT);
}
out_put_cred:
put_rpccred(msg.rpc_cred);
out:
if (status == -EIO)
atomic_set(&clp->cl_callback.cb_set, 0);
/* Success or failure, now we're either waiting for lease expiration
* or deleg_return. */
dprintk("NFSD: nfs4_cb_recall: dp %p dl_flock %p dl_count %d\n",dp, dp->dl_flock, atomic_read(&dp->dl_count));
put_nfs4_client(clp);
nfs4_put_delegation(dp);
return;
}
8 changes: 5 additions & 3 deletions trunk/fs/nfsd/nfs4idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
{
struct ent ent, *res;
char *buf1, *bp;
int len;
int error = -EINVAL;

if (buf[buflen - 1] != '\n')
Expand Down Expand Up @@ -248,10 +249,11 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
goto out;

/* Name */
error = qword_get(&buf, buf1, PAGE_SIZE);
if (error == -EINVAL)
error = -EINVAL;
len = qword_get(&buf, buf1, PAGE_SIZE);
if (len < 0)
goto out;
if (error == -ENOENT)
if (len == 0)
set_bit(CACHE_NEGATIVE, &ent.h.flags);
else {
if (error >= IDMAP_NAMESZ) {
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
break;
case NFS4_OPEN_CLAIM_DELEGATE_PREV:
open->op_stateowner->so_confirmed = 1;
printk("NFSD: unsupported OPEN claim type %d\n",
dprintk("NFSD: unsupported OPEN claim type %d\n",
open->op_claim_type);
status = nfserr_notsupp;
goto out;
default:
printk("NFSD: Invalid OPEN claim type %d\n",
dprintk("NFSD: Invalid OPEN claim type %d\n",
open->op_claim_type);
status = nfserr_inval;
goto out;
Expand Down
Loading

0 comments on commit 1a0b1c0

Please sign in to comment.