Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46091
b: refs/heads/master
c: 886ae1f
h: refs/heads/master
i:
  46089: 493b1ce
  46087: 9c3797a
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Feb 4, 2007
1 parent 975b24a commit b59696d
Show file tree
Hide file tree
Showing 46 changed files with 615 additions and 426 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: 588a700b269b785b19d5d03084bee5e1b74c7758
refs/heads/master: 886ae1fa1380309d91cdb7e67bd4bf71e053c1d5
3 changes: 2 additions & 1 deletion trunk/drivers/usb/net/rtl8150.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
u8 data[3], tmp;

data[0] = phy;
*(data + 1) = cpu_to_le16p(&reg);
data[1] = reg & 0xff;
data[2] = (reg >> 8) & 0xff;
tmp = indx | PHY_WRITE | PHY_GO;
i = 0;

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
9 changes: 2 additions & 7 deletions trunk/fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,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 @@ -1069,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
37 changes: 6 additions & 31 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 int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
static inline int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
{
if (IS_ROOT(dentry))
return 1;
Expand All @@ -652,12 +652,6 @@ 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 @@ -791,7 +785,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
goto out_bad;

nfs_renew_times(dentry);
nfs_refresh_verifier(dentry, verifier);
nfs_set_verifier(dentry, verifier);
out_valid:
unlock_kernel();
dput(parent);
Expand Down Expand Up @@ -1091,7 +1085,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_refresh_verifier(dentry, verifier);
nfs_set_verifier(dentry, verifier);
unlock_kernel();
out:
dput(parent);
Expand Down Expand Up @@ -1129,21 +1123,8 @@ 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) {
/* 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 (dentry != NULL)
return dentry;
if (!desc->plus || !(entry->fattr->valid & NFS_ATTR_FATTR))
return NULL;
/* Note: caller is already holding the dir->i_mutex! */
Expand All @@ -1168,10 +1149,6 @@ 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 @@ -1466,8 +1443,6 @@ 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 @@ -1709,7 +1684,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_refresh_verifier(new_dentry, nfs_save_change_attribute(new_dir));
nfs_set_verifier(new_dentry, nfs_save_change_attribute(new_dir));
}

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

rpc_execute(&data->task);

dprintk("NFS: %5u initiated direct read call "
"(req %s/%Ld, %zu bytes @ offset %Lu)\n",
dfprintk(VFS, "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 @@ -640,8 +639,7 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l

rpc_execute(&data->task);

dprintk("NFS: %5u initiated direct write call "
"(req %s/%Ld, %zu bytes @ offset %Lu)\n",
dfprintk(VFS, "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 @@ -799,7 +797,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;

dprintk("nfs: direct write(%s/%s, %lu@%Ld)\n",
dfprintk(VFS, "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: 5 additions & 6 deletions trunk/fs/nfs/getroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,17 @@ 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);

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

/* Start by getting the root filehandle from the server */
ret = server->nfs_client->rpc_ops->getroot(server, mntfh, &fsinfo);
Expand All @@ -158,7 +160,6 @@ 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 @@ -186,7 +187,6 @@ 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,7 +212,6 @@ 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
15 changes: 5 additions & 10 deletions trunk/fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,13 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)

int nfs_write_inode(struct inode *inode, int sync)
{
int flags = sync ? FLUSH_SYNC : 0;
int ret;

if (sync) {
ret = filemap_fdatawait(inode->i_mapping);
if (ret == 0)
ret = nfs_commit_inode(inode, FLUSH_SYNC);
} else
ret = nfs_commit_inode(inode, 0);
if (ret >= 0)
return 0;
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
return ret;
ret = nfs_commit_inode(inode, flags);
if (ret < 0)
return ret;
return 0;
}

void nfs_clear_inode(struct inode *inode)
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/nfs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
/* nfs4proc.c */
#ifdef CONFIG_NFS_V4
extern struct rpc_procinfo nfs4_procedures[];

extern int nfs4_proc_fs_locations(struct inode *dir, struct dentry *dentry,
struct nfs4_fs_locations *fs_locations,
struct page *page);
#endif

/* dir.c */
Expand Down
24 changes: 24 additions & 0 deletions trunk/fs/nfs/nfs3proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,29 @@ static int nfs3_proc_readlink(struct inode *inode, struct page *page,
return status;
}

static int nfs3_proc_read(struct nfs_read_data *rdata)
{
int flags = rdata->flags;
struct inode * inode = rdata->inode;
struct nfs_fattr * fattr = rdata->res.fattr;
struct rpc_message msg = {
.rpc_proc = &nfs3_procedures[NFS3PROC_READ],
.rpc_argp = &rdata->args,
.rpc_resp = &rdata->res,
.rpc_cred = rdata->cred,
};
int status;

dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
(long long) rdata->args.offset);
nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
if (status >= 0)
nfs_refresh_inode(inode, fattr);
dprintk("NFS reply read: %d\n", status);
return status;
}

/*
* Create a regular file.
* For now, we don't implement O_EXCL.
Expand Down Expand Up @@ -832,6 +855,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
.lookup = nfs3_proc_lookup,
.access = nfs3_proc_access,
.readlink = nfs3_proc_readlink,
.read = nfs3_proc_read,
.create = nfs3_proc_create,
.remove = nfs3_proc_remove,
.unlink_setup = nfs3_proc_unlink_setup,
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/nfs/nfs4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state);
extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *);
extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *);
extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
extern int nfs4_proc_fs_locations(struct inode *dir, struct qstr *name,
extern int nfs4_proc_fs_locations(struct inode *dir, struct dentry *dentry,
struct nfs4_fs_locations *fs_locations, struct page *page);

extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops;
Expand Down
16 changes: 9 additions & 7 deletions trunk/fs/nfs/nfs4namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <linux/vfs.h>
#include <linux/inet.h>
#include "internal.h"
#include "nfs4_fs.h"

#define NFSDBG_FACILITY NFSDBG_VFS

Expand Down Expand Up @@ -131,6 +130,7 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
.authflavor = NFS_SB(mnt_parent->mnt_sb)->client->cl_auth->au_flavor,
};
char *page = NULL, *page2 = NULL;
char *devname;
int loc, s, error;

if (locations == NULL || locations->nlocations <= 0)
Expand All @@ -154,6 +154,12 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
goto out;
}

devname = nfs_devname(mnt_parent, dentry, page, PAGE_SIZE);
if (IS_ERR(devname)) {
mnt = (struct vfsmount *)devname;
goto out;
}

loc = 0;
while (loc < locations->nlocations && IS_ERR(mnt)) {
const struct nfs4_fs_location *location = &locations->locations[loc];
Expand Down Expand Up @@ -188,11 +194,7 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
addr.sin_port = htons(NFS_PORT);
mountdata.addr = &addr;

snprintf(page, PAGE_SIZE, "%s:%s",
mountdata.hostname,
mountdata.mnt_path);

mnt = vfs_kern_mount(&nfs4_referral_fs_type, 0, page, &mountdata);
mnt = vfs_kern_mount(&nfs4_referral_fs_type, 0, devname, &mountdata);
if (!IS_ERR(mnt)) {
break;
}
Expand Down Expand Up @@ -240,7 +242,7 @@ struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentr
dprintk("%s: getting locations for %s/%s\n",
__FUNCTION__, parent->d_name.name, dentry->d_name.name);

err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page);
err = nfs4_proc_fs_locations(parent->d_inode, dentry, fs_locations, page);
dput(parent);
if (err != 0 ||
fs_locations->nlocations <= 0 ||
Expand Down
Loading

0 comments on commit b59696d

Please sign in to comment.