Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42637
b: refs/heads/master
c: 676dcb8
h: refs/heads/master
i:
  42635: 3b1c5bb
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Dec 7, 2006
1 parent 65d2bd5 commit cd8ac60
Show file tree
Hide file tree
Showing 48 changed files with 1,793 additions and 1,564 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: 34161db6b14d984fb9b06c735b7b42f8803f6851
refs/heads/master: 676dcb8bc2ec78d80091037773598d6ec8c673d6
2 changes: 1 addition & 1 deletion trunk/fs/lockd/clntproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static void nlmclnt_cancel_callback(struct rpc_task *task, void *data)
goto retry_cancel;
}

dprintk("lockd: cancel status %u (task %u)\n",
dprintk("lockd: cancel status %d (task %d)\n",
req->a_res.status, task->tk_pid);

switch (req->a_res.status) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/lockd/svc4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
*/
static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
{
dprintk("lockd: %5u callback returned %d\n", task->tk_pid,
dprintk("lockd: %4d callback returned %d\n", task->tk_pid,
-task->tk_status);
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/lockd/svcproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
*/
static void nlmsvc_callback_exit(struct rpc_task *task, void *data)
{
dprintk("lockd: %5u callback returned %d\n", task->tk_pid,
dprintk("lockd: %4d callback returned %d\n", task->tk_pid,
-task->tk_status);
}

Expand Down
6 changes: 6 additions & 0 deletions trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo

data->task.tk_cookie = (unsigned long) inode;

lock_kernel();
rpc_execute(&data->task);
unlock_kernel();

dfprintk(VFS, "NFS: %5u initiated direct read call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
data->task.tk_pid,
Expand Down Expand Up @@ -473,7 +475,9 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)

dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);

lock_kernel();
rpc_execute(&data->task);
unlock_kernel();
}

static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
Expand Down Expand Up @@ -637,7 +641,9 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
data->task.tk_priority = RPC_PRIORITY_NORMAL;
data->task.tk_cookie = (unsigned long) inode;

lock_kernel();
rpc_execute(&data->task);
unlock_kernel();

dfprintk(VFS, "NFS: %5u initiated direct write call (req %s/%Ld, %zu bytes @ offset %Lu)\n",
data->task.tk_pid,
Expand Down
28 changes: 11 additions & 17 deletions trunk/fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,28 +307,28 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse

static void nfs_invalidate_page(struct page *page, unsigned long offset)
{
if (offset != 0)
return;
struct inode *inode = page->mapping->host;

/* Cancel any unstarted writes on this page */
nfs_wb_page_priority(page->mapping->host, page, FLUSH_INVALIDATE);
if (offset == 0)
nfs_sync_inode_wait(inode, page->index, 1, FLUSH_INVALIDATE);
}

static int nfs_release_page(struct page *page, gfp_t gfp)
{
/*
* Avoid deadlock on nfs_wait_on_request().
*/
if (!(gfp & __GFP_FS))
if (gfp & __GFP_FS)
return !nfs_wb_page(page->mapping->host, page);
else
/*
* Avoid deadlock on nfs_wait_on_request().
*/
return 0;
/* Hack... Force nfs_wb_page() to write out the page */
SetPageDirty(page);
return !nfs_wb_page(page->mapping->host, page);
}

const struct address_space_operations nfs_file_aops = {
.readpage = nfs_readpage,
.readpages = nfs_readpages,
.set_page_dirty = nfs_set_page_dirty,
.set_page_dirty = __set_page_dirty_nobuffers,
.writepage = nfs_writepage,
.writepages = nfs_writepages,
.prepare_write = nfs_prepare_write,
Expand Down Expand Up @@ -375,12 +375,6 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,

nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count);
result = generic_file_aio_write(iocb, iov, nr_segs, pos);
/* Return error values for O_SYNC and IS_SYNC() */
if (result >= 0 && (IS_SYNC(inode) || (iocb->ki_filp->f_flags & O_SYNC))) {
int err = nfs_fsync(iocb->ki_filp, dentry, 1);
if (err < 0)
result = err;
}
out:
return result;

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
int err;

/* Flush out writes to the server in order to update c/mtime */
nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT);
nfs_sync_inode_wait(inode, 0, 0, FLUSH_NOCOMMIT);

/*
* We may force a getattr if the user cares about atime.
Expand Down
18 changes: 0 additions & 18 deletions trunk/fs/nfs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,3 @@ void nfs_super_set_maxbytes(struct super_block *sb, __u64 maxfilesize)
if (sb->s_maxbytes > MAX_LFS_FILESIZE || sb->s_maxbytes <= 0)
sb->s_maxbytes = MAX_LFS_FILESIZE;
}

/*
* Determine the number of bytes of data the page contains
*/
static inline
unsigned int nfs_page_length(struct page *page)
{
loff_t i_size = i_size_read(page->mapping->host);

if (i_size > 0) {
pgoff_t end_index = (i_size - 1) >> PAGE_CACHE_SHIFT;
if (page->index < end_index)
return PAGE_CACHE_SIZE;
if (page->index == end_index)
return ((i_size - 1) & ~PAGE_CACHE_MASK) + 1;
}
return 0;
}
52 changes: 51 additions & 1 deletion trunk/fs/nfs/nfs3proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,51 @@ static int nfs3_proc_read(struct nfs_read_data *rdata)
return status;
}

static int nfs3_proc_write(struct nfs_write_data *wdata)
{
int rpcflags = wdata->flags;
struct inode * inode = wdata->inode;
struct nfs_fattr * fattr = wdata->res.fattr;
struct rpc_message msg = {
.rpc_proc = &nfs3_procedures[NFS3PROC_WRITE],
.rpc_argp = &wdata->args,
.rpc_resp = &wdata->res,
.rpc_cred = wdata->cred,
};
int status;

dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
(long long) wdata->args.offset);
nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, rpcflags);
if (status >= 0)
nfs_post_op_update_inode(inode, fattr);
dprintk("NFS reply write: %d\n", status);
return status < 0? status : wdata->res.count;
}

static int nfs3_proc_commit(struct nfs_write_data *cdata)
{
struct inode * inode = cdata->inode;
struct nfs_fattr * fattr = cdata->res.fattr;
struct rpc_message msg = {
.rpc_proc = &nfs3_procedures[NFS3PROC_COMMIT],
.rpc_argp = &cdata->args,
.rpc_resp = &cdata->res,
.rpc_cred = cdata->cred,
};
int status;

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

/*
* Create a regular file.
* For now, we don't implement O_EXCL.
Expand Down Expand Up @@ -324,7 +369,7 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,

/* If the server doesn't support the exclusive creation semantics,
* try again with simple 'guarded' mode. */
if (status == -ENOTSUPP) {
if (status == NFSERR_NOTSUPP) {
switch (arg.createmode) {
case NFS3_CREATE_EXCLUSIVE:
arg.createmode = NFS3_CREATE_GUARDED;
Expand Down Expand Up @@ -645,6 +690,8 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
};
int status;

lock_kernel();

if (plus)
msg.rpc_proc = &nfs3_procedures[NFS3PROC_READDIRPLUS];

Expand All @@ -655,6 +702,7 @@ nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
nfs_refresh_inode(dir, &dir_attr);
dprintk("NFS reply readdir: %d\n", status);
unlock_kernel();
return status;
}

Expand Down Expand Up @@ -856,6 +904,8 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
.access = nfs3_proc_access,
.readlink = nfs3_proc_readlink,
.read = nfs3_proc_read,
.write = nfs3_proc_write,
.commit = nfs3_proc_commit,
.create = nfs3_proc_create,
.remove = nfs3_proc_remove,
.unlink_setup = nfs3_proc_unlink_setup,
Expand Down
99 changes: 93 additions & 6 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
smp_wmb();
} else
status = data->rpc_status;
rpc_put_task(task);
rpc_release_task(task);
return status;
}

Expand Down Expand Up @@ -742,7 +742,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
smp_wmb();
} else
status = data->rpc_status;
rpc_put_task(task);
rpc_release_task(task);
if (status != 0)
return status;

Expand Down Expand Up @@ -1775,6 +1775,89 @@ static int nfs4_proc_read(struct nfs_read_data *rdata)
return err;
}

static int _nfs4_proc_write(struct nfs_write_data *wdata)
{
int rpcflags = wdata->flags;
struct inode *inode = wdata->inode;
struct nfs_fattr *fattr = wdata->res.fattr;
struct nfs_server *server = NFS_SERVER(inode);
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE],
.rpc_argp = &wdata->args,
.rpc_resp = &wdata->res,
.rpc_cred = wdata->cred,
};
int status;

dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
(long long) wdata->args.offset);

wdata->args.bitmask = server->attr_bitmask;
wdata->res.server = server;
wdata->timestamp = jiffies;
nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, rpcflags);
dprintk("NFS reply write: %d\n", status);
if (status < 0)
return status;
renew_lease(server, wdata->timestamp);
nfs_post_op_update_inode(inode, fattr);
return wdata->res.count;
}

static int nfs4_proc_write(struct nfs_write_data *wdata)
{
struct nfs4_exception exception = { };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(wdata->inode),
_nfs4_proc_write(wdata),
&exception);
} while (exception.retry);
return err;
}

static int _nfs4_proc_commit(struct nfs_write_data *cdata)
{
struct inode *inode = cdata->inode;
struct nfs_fattr *fattr = cdata->res.fattr;
struct nfs_server *server = NFS_SERVER(inode);
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT],
.rpc_argp = &cdata->args,
.rpc_resp = &cdata->res,
.rpc_cred = cdata->cred,
};
int status;

dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
(long long) cdata->args.offset);

cdata->args.bitmask = server->attr_bitmask;
cdata->res.server = server;
cdata->timestamp = jiffies;
nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, 0);
if (status >= 0)
renew_lease(server, cdata->timestamp);
dprintk("NFS reply commit: %d\n", status);
if (status >= 0)
nfs_post_op_update_inode(inode, fattr);
return status;
}

static int nfs4_proc_commit(struct nfs_write_data *cdata)
{
struct nfs4_exception exception = { };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(cdata->inode),
_nfs4_proc_commit(cdata),
&exception);
} while (exception.retry);
return err;
}

/*
* Got race?
* We will need to arrange for the VFS layer to provide an atomic open.
Expand Down Expand Up @@ -2140,11 +2223,13 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
dentry->d_parent->d_name.name,
dentry->d_name.name,
(unsigned long long)cookie);
lock_kernel();
nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
res.pgbase = args.pgbase;
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
if (status == 0)
memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
unlock_kernel();
dprintk("%s: returns %d\n", __FUNCTION__, status);
return status;
}
Expand Down Expand Up @@ -2982,7 +3067,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
if (status == 0)
nfs_post_op_update_inode(inode, &data->fattr);
}
rpc_put_task(task);
rpc_release_task(task);
return status;
}

Expand Down Expand Up @@ -3229,7 +3314,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
if (IS_ERR(task))
goto out;
status = nfs4_wait_for_completion_rpc_task(task);
rpc_put_task(task);
rpc_release_task(task);
out:
return status;
}
Expand Down Expand Up @@ -3345,7 +3430,7 @@ static void nfs4_lock_release(void *calldata)
task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
data->arg.lock_seqid);
if (!IS_ERR(task))
rpc_put_task(task);
rpc_release_task(task);
dprintk("%s: cancelling lock!\n", __FUNCTION__);
} else
nfs_free_seqid(data->arg.lock_seqid);
Expand Down Expand Up @@ -3387,7 +3472,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
ret = -EAGAIN;
} else
data->cancelled = 1;
rpc_put_task(task);
rpc_release_task(task);
dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret);
return ret;
}
Expand Down Expand Up @@ -3647,6 +3732,8 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
.access = nfs4_proc_access,
.readlink = nfs4_proc_readlink,
.read = nfs4_proc_read,
.write = nfs4_proc_write,
.commit = nfs4_proc_commit,
.create = nfs4_proc_create,
.remove = nfs4_proc_remove,
.unlink_setup = nfs4_proc_unlink_setup,
Expand Down
Loading

0 comments on commit cd8ac60

Please sign in to comment.