Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48126
b: refs/heads/master
c: d9bc125
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Feb 13, 2007
1 parent 51f411c commit b2f046b
Show file tree
Hide file tree
Showing 46 changed files with 477 additions and 636 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: ec2f9d1331f658433411c58077871e1eef4ee1b4
refs/heads/master: d9bc125caf592b7d081021f32ce5b717efdf70c8
9 changes: 3 additions & 6 deletions trunk/fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ static int __nlm_async_call(struct nlm_rqst *req, u32 proc, struct rpc_message *
{
struct nlm_host *host = req->a_host;
struct rpc_clnt *clnt;
int status = -ENOLCK;

dprintk("lockd: call procedure %d on %s (async)\n",
(int)proc, host->h_name);
Expand All @@ -373,12 +372,10 @@ static int __nlm_async_call(struct nlm_rqst *req, u32 proc, struct rpc_message *
msg->rpc_proc = &clnt->cl_procinfo[proc];

/* bootstrap and kick off the async RPC call */
status = rpc_call_async(clnt, msg, RPC_TASK_ASYNC, tk_ops, req);
if (status == 0)
return 0;
return rpc_call_async(clnt, msg, RPC_TASK_ASYNC, tk_ops, req);
out_err:
nlm_release_call(req);
return status;
tk_ops->rpc_release(req);
return -ENOLCK;
}

int nlm_async_call(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops)
Expand Down
4 changes: 1 addition & 3 deletions trunk/fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,7 @@ nlmsvc_grant_blocked(struct nlm_block *block)

/* Call the client */
kref_get(&block->b_count);
if (nlm_async_call(block->b_call, NLMPROC_GRANTED_MSG,
&nlmsvc_grant_ops) < 0)
nlmsvc_release_block(block);
nlm_async_call(block->b_call, NLMPROC_GRANTED_MSG, &nlmsvc_grant_ops);
}

/*
Expand Down
18 changes: 13 additions & 5 deletions trunk/fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
unsigned int timeo,
unsigned int retrans,
rpc_authflavor_t flavor)
rpc_authflavor_t flavor,
int flags)
{
struct rpc_timeout timeparms;
struct rpc_clnt *clnt = NULL;
Expand All @@ -407,6 +408,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
.program = &nfs_program,
.version = clp->rpc_ops->version,
.authflavor = flavor,
.flags = flags,
};

if (!IS_ERR(clp->cl_rpcclient))
Expand Down Expand Up @@ -548,7 +550,7 @@ static int nfs_init_client(struct nfs_client *clp, const struct nfs_mount_data *
* - RFC 2623, sec 2.3.2
*/
error = nfs_create_rpc_client(clp, proto, data->timeo, data->retrans,
RPC_AUTH_UNIX);
RPC_AUTH_UNIX, 0);
if (error < 0)
goto error;
nfs_mark_client_ready(clp, NFS_CS_READY);
Expand Down Expand Up @@ -868,7 +870,8 @@ static int nfs4_init_client(struct nfs_client *clp,
/* Check NFS protocol revision and initialize RPC op vector */
clp->rpc_ops = &nfs_v4_clientops;

error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour);
error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour,
RPC_CLNT_CREATE_DISCRTRY);
if (error < 0)
goto error;
memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
Expand Down Expand Up @@ -1030,7 +1033,7 @@ struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *data,
* Create an NFS4 referral server record
*/
struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
struct nfs_fh *fh)
struct nfs_fh *mntfh)
{
struct nfs_client *parent_client;
struct nfs_server *server, *parent_server;
Expand Down Expand Up @@ -1069,8 +1072,13 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
BUG_ON(!server->nfs_client->rpc_ops);
BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);

/* Probe the root fh to retrieve its FSID and filehandle */
error = nfs4_path_walk(server, mntfh, data->mnt_path);
if (error < 0)
goto error;

/* probe the filesystem info for this server filesystem */
error = nfs_probe_fsinfo(server, fh, &fattr);
error = nfs_probe_fsinfo(server, mntfh, &fattr);
if (error < 0)
goto error;

Expand Down
37 changes: 31 additions & 6 deletions trunk/fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync)
* In the case it has, we assume that the dentries are untrustworthy
* and may need to be looked up again.
*/
static inline int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
{
if (IS_ROOT(dentry))
return 1;
Expand All @@ -652,6 +652,12 @@ static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
dentry->d_fsdata = (void *)verf;
}

static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf)
{
if (time_after(verf, (unsigned long)dentry->d_fsdata))
nfs_set_verifier(dentry, verf);
}

/*
* Whenever an NFS operation succeeds, we know that the dentry
* is valid, so we update the revalidation timestamp.
Expand Down Expand Up @@ -785,7 +791,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
goto out_bad;

nfs_renew_times(dentry);
nfs_set_verifier(dentry, verifier);
nfs_refresh_verifier(dentry, verifier);
out_valid:
unlock_kernel();
dput(parent);
Expand Down Expand Up @@ -1085,7 +1091,7 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd)
verifier = nfs_save_change_attribute(dir);
ret = nfs4_open_revalidate(dir, dentry, openflags, nd);
if (!ret)
nfs_set_verifier(dentry, verifier);
nfs_refresh_verifier(dentry, verifier);
unlock_kernel();
out:
dput(parent);
Expand Down Expand Up @@ -1123,8 +1129,21 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
}
name.hash = full_name_hash(name.name, name.len);
dentry = d_lookup(parent, &name);
if (dentry != NULL)
return dentry;
if (dentry != NULL) {
/* Is this a positive dentry that matches the readdir info? */
if (dentry->d_inode != NULL &&
(NFS_FILEID(dentry->d_inode) == entry->ino ||
d_mountpoint(dentry))) {
if (!desc->plus || entry->fh->size == 0)
return dentry;
if (nfs_compare_fh(NFS_FH(dentry->d_inode),
entry->fh) == 0)
goto out_renew;
}
/* No, so d_drop to allow one to be created */
d_drop(dentry);
dput(dentry);
}
if (!desc->plus || !(entry->fattr->valid & NFS_ATTR_FATTR))
return NULL;
/* Note: caller is already holding the dir->i_mutex! */
Expand All @@ -1149,6 +1168,10 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
nfs_renew_times(dentry);
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
return dentry;
out_renew:
nfs_renew_times(dentry);
nfs_refresh_verifier(dentry, nfs_save_change_attribute(dir));
return dentry;
}

/*
Expand Down Expand Up @@ -1443,6 +1466,8 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry)
if (atomic_read(&dentry->d_count) > 1) {
spin_unlock(&dentry->d_lock);
spin_unlock(&dcache_lock);
/* Start asynchronous writeout of the inode */
write_inode_now(dentry->d_inode, 0);
error = nfs_sillyrename(dir, dentry);
unlock_kernel();
return error;
Expand Down Expand Up @@ -1684,7 +1709,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (!error) {
d_move(old_dentry, new_dentry);
nfs_renew_times(new_dentry);
nfs_set_verifier(new_dentry, nfs_save_change_attribute(new_dir));
nfs_refresh_verifier(new_dentry, nfs_save_change_attribute(new_dir));
}

/* new dentry created? */
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo

rpc_execute(&data->task);

dfprintk(VFS, "NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
dprintk("NFS: %5u initiated direct read call "
"(req %s/%Ld, %zu bytes @ offset %Lu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
Expand Down Expand Up @@ -639,7 +640,8 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l

rpc_execute(&data->task);

dfprintk(VFS, "NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
dprintk("NFS: %5u initiated direct write call "
"(req %s/%Ld, %zu bytes @ offset %Lu)\n",
data->task.tk_pid,
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
Expand Down Expand Up @@ -797,7 +799,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
const char __user *buf = iov[0].iov_base;
size_t count = iov[0].iov_len;

dfprintk(VFS, "nfs: direct write(%s/%s, %lu@%Ld)\n",
dprintk("nfs: direct write(%s/%s, %lu@%Ld)\n",
file->f_path.dentry->d_parent->d_name.name,
file->f_path.dentry->d_name.name,
(unsigned long) count, (long long) pos);
Expand Down
11 changes: 6 additions & 5 deletions trunk/fs/nfs/getroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,15 @@ int nfs4_path_walk(struct nfs_server *server,
struct nfs_fh lastfh;
struct qstr name;
int ret;
//int referral_count = 0;

dprintk("--> nfs4_path_walk(,,%s)\n", path);

fsinfo.fattr = &fattr;
nfs_fattr_init(&fattr);

if (*path++ != '/') {
dprintk("nfs4_get_root: Path does not begin with a slash\n");
return -EINVAL;
}
/* Eat leading slashes */
while (*path == '/')
path++;

/* Start by getting the root filehandle from the server */
ret = server->nfs_client->rpc_ops->getroot(server, mntfh, &fsinfo);
Expand All @@ -160,6 +158,7 @@ int nfs4_path_walk(struct nfs_server *server,
return -ENOTDIR;
}

/* FIXME: It is quite valid for the server to return a referral here */
if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) {
printk(KERN_ERR "nfs4_get_root:"
" getroot obtained referral\n");
Expand Down Expand Up @@ -187,6 +186,7 @@ int nfs4_path_walk(struct nfs_server *server,
goto eat_dot_dir;
}

/* FIXME: Why shouldn't the user be able to use ".." in the path? */
if (path[0] == '.' && path[1] == '.' && (path[2] == '/' || !path[2])
) {
printk(KERN_ERR "nfs4_get_root:"
Expand All @@ -212,6 +212,7 @@ int nfs4_path_walk(struct nfs_server *server,
return -ENOTDIR;
}

/* FIXME: Referrals are quite valid here too */
if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) {
printk(KERN_ERR "nfs4_get_root:"
" lookupfh obtained referral\n");
Expand Down
Loading

0 comments on commit b2f046b

Please sign in to comment.