Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 48127
b: refs/heads/master
c: 552ce54
h: refs/heads/master
i:
  48125: 51f411c
  48123: 12fdc12
  48119: c2a3d8c
  48111: 8e778f0
  48095: b6d9fdc
  48063: 2ee2b32
  47999: 59ed087
  47871: 2b28476
  47615: a8b5a4b
  47103: 4cb2606
v: v3
  • Loading branch information
Linus Torvalds committed Feb 13, 2007
1 parent b2f046b commit 80eb318
Show file tree
Hide file tree
Showing 47 changed files with 706 additions and 557 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: d9bc125caf592b7d081021f32ce5b717efdf70c8
refs/heads/master: 552ce544edfbe9bce79952a8c0f8d65b7f2d16bb
150 changes: 70 additions & 80 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1739,41 +1739,45 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
* @rootmnt: vfsmnt to which the root dentry belongs
* @buffer: buffer to return value in
* @buflen: buffer length
* @fail_deleted: what to return for deleted files
*
* Convert a dentry into an ASCII path name. If the entry has been deleted,
* then if @fail_deleted is true, ERR_PTR(-ENOENT) is returned. Otherwise,
* the the string " (deleted)" is appended. Note that this is ambiguous.
* Convert a dentry into an ASCII path name. If the entry has been deleted
* the string " (deleted)" is appended. Note that this is ambiguous.
*
* Returns the buffer or an error code.
* Returns the buffer or an error code if the path was too long.
*
* "buflen" should be positive. Caller holds the dcache_lock.
*/
static char *__d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
struct dentry *root, struct vfsmount *rootmnt,
char *buffer, int buflen, int fail_deleted)
static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
struct dentry *root, struct vfsmount *rootmnt,
char *buffer, int buflen)
{
int namelen, is_slash;

if (buflen < 2)
return ERR_PTR(-ENAMETOOLONG);
buffer += --buflen;
*buffer = '\0';
char * end = buffer+buflen;
char * retval;
int namelen;

spin_lock(&dcache_lock);
*--end = '\0';
buflen--;
if (!IS_ROOT(dentry) && d_unhashed(dentry)) {
if (fail_deleted) {
buffer = ERR_PTR(-ENOENT);
goto out;
}
if (buflen < 10)
goto Elong;
buflen -= 10;
buffer -= 10;
memcpy(buffer, " (deleted)", 10);
end -= 10;
if (buflen < 0)
goto Elong;
memcpy(end, " (deleted)", 10);
}
while (dentry != root || vfsmnt != rootmnt) {

if (buflen < 1)
goto Elong;
/* Get '/' right */
retval = end-1;
*retval = '/';

for (;;) {
struct dentry * parent;

if (dentry == root && vfsmnt == rootmnt)
break;
if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
/* Global root? */
spin_lock(&vfsmount_lock);
if (vfsmnt->mnt_parent == vfsmnt) {
spin_unlock(&vfsmount_lock);
Expand All @@ -1787,60 +1791,33 @@ static char *__d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
parent = dentry->d_parent;
prefetch(parent);
namelen = dentry->d_name.len;
if (buflen <= namelen)
goto Elong;
buflen -= namelen + 1;
buffer -= namelen;
memcpy(buffer, dentry->d_name.name, namelen);
*--buffer = '/';
if (buflen < 0)
goto Elong;
end -= namelen;
memcpy(end, dentry->d_name.name, namelen);
*--end = '/';
retval = end;
dentry = parent;
}
/* Get '/' right */
if (*buffer != '/')
*--buffer = '/';

out:
spin_unlock(&dcache_lock);
return buffer;
return retval;

global_root:
/*
* We went past the (vfsmount, dentry) we were looking for and have
* either hit a root dentry, a lazily unmounted dentry, an
* unconnected dentry, or the file is on a pseudo filesystem.
*/
namelen = dentry->d_name.len;
is_slash = (namelen == 1 && *dentry->d_name.name == '/');
if (is_slash || (dentry->d_sb->s_flags & MS_NOUSER)) {
/*
* Make sure we won't return a pathname starting with '/'.
*
* Historically, we also glue together the root dentry and
* remaining name for pseudo filesystems like pipefs, which
* have the MS_NOUSER flag set. This results in pathnames
* like "pipe:[439336]".
*/
if (*buffer == '/') {
buffer++;
buflen++;
}
if (is_slash)
goto out;
}
if (buflen < namelen)
buflen -= namelen;
if (buflen < 0)
goto Elong;
buffer -= namelen;
memcpy(buffer, dentry->d_name.name, namelen);
goto out;

retval -= namelen-1; /* hit the slash */
memcpy(retval, dentry->d_name.name, namelen);
return retval;
Elong:
buffer = ERR_PTR(-ENAMETOOLONG);
goto out;
return ERR_PTR(-ENAMETOOLONG);
}

/* write full pathname into buffer and return start of pathname */
char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt, char *buf,
int buflen)
char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
char *buf, int buflen)
{
char *res;
struct vfsmount *rootmnt;
Expand All @@ -1850,7 +1827,9 @@ char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt, char *buf,
rootmnt = mntget(current->fs->rootmnt);
root = dget(current->fs->root);
read_unlock(&current->fs->lock);
res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen, 0);
spin_lock(&dcache_lock);
res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen);
spin_unlock(&dcache_lock);
dput(root);
mntput(rootmnt);
return res;
Expand All @@ -1876,10 +1855,10 @@ char *d_path(struct dentry *dentry, struct vfsmount *vfsmnt, char *buf,
*/
asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
{
int error, len;
int error;
struct vfsmount *pwdmnt, *rootmnt;
struct dentry *pwd, *root;
char *page = (char *) __get_free_page(GFP_USER), *cwd;
char *page = (char *) __get_free_page(GFP_USER);

if (!page)
return -ENOMEM;
Expand All @@ -1891,18 +1870,29 @@ asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
root = dget(current->fs->root);
read_unlock(&current->fs->lock);

cwd = __d_path(pwd, pwdmnt, root, rootmnt, page, PAGE_SIZE, 1);
error = PTR_ERR(cwd);
if (IS_ERR(cwd))
goto out;
error = -ENOENT;
/* Has the current directory has been unlinked? */
spin_lock(&dcache_lock);
if (pwd->d_parent == pwd || !d_unhashed(pwd)) {
unsigned long len;
char * cwd;

error = -ERANGE;
len = PAGE_SIZE + page - cwd;
if (len <= size) {
error = len;
if (copy_to_user(buf, cwd, len))
error = -EFAULT;
}
cwd = __d_path(pwd, pwdmnt, root, rootmnt, page, PAGE_SIZE);
spin_unlock(&dcache_lock);

error = PTR_ERR(cwd);
if (IS_ERR(cwd))
goto out;

error = -ERANGE;
len = PAGE_SIZE + page - cwd;
if (len <= size) {
error = len;
if (copy_to_user(buf, cwd, len))
error = -EFAULT;
}
} else
spin_unlock(&dcache_lock);

out:
dput(pwd);
Expand Down
9 changes: 6 additions & 3 deletions trunk/fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ 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 @@ -372,10 +373,12 @@ 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 */
return rpc_call_async(clnt, msg, RPC_TASK_ASYNC, tk_ops, req);
status = rpc_call_async(clnt, msg, RPC_TASK_ASYNC, tk_ops, req);
if (status == 0)
return 0;
out_err:
tk_ops->rpc_release(req);
return -ENOLCK;
nlm_release_call(req);
return status;
}

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

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

/*
Expand Down
18 changes: 5 additions & 13 deletions trunk/fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ 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,
int flags)
rpc_authflavor_t flavor)
{
struct rpc_timeout timeparms;
struct rpc_clnt *clnt = NULL;
Expand All @@ -408,7 +407,6 @@ 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 @@ -550,7 +548,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, 0);
RPC_AUTH_UNIX);
if (error < 0)
goto error;
nfs_mark_client_ready(clp, NFS_CS_READY);
Expand Down Expand Up @@ -870,8 +868,7 @@ 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,
RPC_CLNT_CREATE_DISCRTRY);
error = nfs_create_rpc_client(clp, proto, timeo, retrans, authflavour);
if (error < 0)
goto error;
memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
Expand Down Expand Up @@ -1033,7 +1030,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 *mntfh)
struct nfs_fh *fh)
{
struct nfs_client *parent_client;
struct nfs_server *server, *parent_server;
Expand Down Expand Up @@ -1072,13 +1069,8 @@ 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, mntfh, &fattr);
error = nfs_probe_fsinfo(server, fh, &fattr);
if (error < 0)
goto error;

Expand Down
Loading

0 comments on commit 80eb318

Please sign in to comment.