Commit 60ccd4ec authored by Trond Myklebust's avatar Trond Myklebust

NFS: Remove nfs_begin_data_update/nfs_end_data_update

The lower level routines in fs/nfs/proc.c, fs/nfs/nfs3proc.c and
fs/nfs/nfs4proc.c should already be dealing with the revalidation issues.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 80eb209d
...@@ -1001,11 +1001,6 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry ...@@ -1001,11 +1001,6 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
goto out; goto out;
} }
if (nd->intent.open.flags & O_CREAT) {
nfs_begin_data_update(dir);
res = nfs4_atomic_open(dir, dentry, nd);
nfs_end_data_update(dir);
} else
res = nfs4_atomic_open(dir, dentry, nd); res = nfs4_atomic_open(dir, dentry, nd);
unlock_kernel(); unlock_kernel();
if (IS_ERR(res)) { if (IS_ERR(res)) {
...@@ -1224,9 +1219,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -1224,9 +1219,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode,
open_flags = nd->intent.open.flags; open_flags = nd->intent.open.flags;
lock_kernel(); lock_kernel();
nfs_begin_data_update(dir);
error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, nd); error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, nd);
nfs_end_data_update(dir);
if (error != 0) if (error != 0)
goto out_err; goto out_err;
unlock_kernel(); unlock_kernel();
...@@ -1256,9 +1249,7 @@ nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1256,9 +1249,7 @@ nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
attr.ia_valid = ATTR_MODE; attr.ia_valid = ATTR_MODE;
lock_kernel(); lock_kernel();
nfs_begin_data_update(dir);
status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev); status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev);
nfs_end_data_update(dir);
if (status != 0) if (status != 0)
goto out_err; goto out_err;
unlock_kernel(); unlock_kernel();
...@@ -1284,9 +1275,7 @@ static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -1284,9 +1275,7 @@ static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
attr.ia_mode = mode | S_IFDIR; attr.ia_mode = mode | S_IFDIR;
lock_kernel(); lock_kernel();
nfs_begin_data_update(dir);
error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr); error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr);
nfs_end_data_update(dir);
if (error != 0) if (error != 0)
goto out_err; goto out_err;
unlock_kernel(); unlock_kernel();
...@@ -1305,12 +1294,10 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -1305,12 +1294,10 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry)
dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
lock_kernel(); lock_kernel();
nfs_begin_data_update(dir);
error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
/* Ensure the VFS deletes this inode */ /* Ensure the VFS deletes this inode */
if (error == 0 && dentry->d_inode != NULL) if (error == 0 && dentry->d_inode != NULL)
clear_nlink(dentry->d_inode); clear_nlink(dentry->d_inode);
nfs_end_data_update(dir);
unlock_kernel(); unlock_kernel();
return error; return error;
...@@ -1368,17 +1355,13 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) ...@@ -1368,17 +1355,13 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
qsilly.name = silly; qsilly.name = silly;
qsilly.len = strlen(silly); qsilly.len = strlen(silly);
nfs_begin_data_update(dir);
if (dentry->d_inode) { if (dentry->d_inode) {
nfs_begin_data_update(dentry->d_inode);
error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, error = NFS_PROTO(dir)->rename(dir, &dentry->d_name,
dir, &qsilly); dir, &qsilly);
nfs_mark_for_revalidate(dentry->d_inode); nfs_mark_for_revalidate(dentry->d_inode);
nfs_end_data_update(dentry->d_inode);
} else } else
error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, error = NFS_PROTO(dir)->rename(dir, &dentry->d_name,
dir, &qsilly); dir, &qsilly);
nfs_end_data_update(dir);
if (!error) { if (!error) {
nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
d_move(dentry, sdentry); d_move(dentry, sdentry);
...@@ -1412,19 +1395,15 @@ static int nfs_safe_remove(struct dentry *dentry) ...@@ -1412,19 +1395,15 @@ static int nfs_safe_remove(struct dentry *dentry)
goto out; goto out;
} }
nfs_begin_data_update(dir);
if (inode != NULL) { if (inode != NULL) {
nfs_inode_return_delegation(inode); nfs_inode_return_delegation(inode);
nfs_begin_data_update(inode);
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
/* The VFS may want to delete this inode */ /* The VFS may want to delete this inode */
if (error == 0) if (error == 0)
drop_nlink(inode); drop_nlink(inode);
nfs_mark_for_revalidate(inode); nfs_mark_for_revalidate(inode);
nfs_end_data_update(inode);
} else } else
error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
nfs_end_data_update(dir);
out: out:
return error; return error;
} }
...@@ -1516,9 +1495,7 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym ...@@ -1516,9 +1495,7 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym
memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen); memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen);
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
nfs_begin_data_update(dir);
error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr);
nfs_end_data_update(dir);
if (error != 0) { if (error != 0) {
dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n", dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n",
dir->i_sb->s_id, dir->i_ino, dir->i_sb->s_id, dir->i_ino,
...@@ -1558,15 +1535,11 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) ...@@ -1558,15 +1535,11 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
dentry->d_parent->d_name.name, dentry->d_name.name); dentry->d_parent->d_name.name, dentry->d_name.name);
lock_kernel(); lock_kernel();
nfs_begin_data_update(dir);
nfs_begin_data_update(inode);
error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
if (error == 0) { if (error == 0) {
atomic_inc(&inode->i_count); atomic_inc(&inode->i_count);
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
} }
nfs_end_data_update(inode);
nfs_end_data_update(dir);
unlock_kernel(); unlock_kernel();
return error; return error;
} }
...@@ -1669,15 +1642,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1669,15 +1642,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
d_delete(new_dentry); d_delete(new_dentry);
} }
nfs_begin_data_update(old_dir);
nfs_begin_data_update(new_dir);
nfs_begin_data_update(old_inode);
error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name,
new_dir, &new_dentry->d_name); new_dir, &new_dentry->d_name);
nfs_mark_for_revalidate(old_inode); nfs_mark_for_revalidate(old_inode);
nfs_end_data_update(old_inode);
nfs_end_data_update(new_dir);
nfs_end_data_update(old_dir);
out: out:
if (rehash) if (rehash)
d_rehash(rehash); d_rehash(rehash);
......
...@@ -510,7 +510,6 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode ...@@ -510,7 +510,6 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
nfs_direct_write_reschedule(dreq); nfs_direct_write_reschedule(dreq);
break; break;
default: default:
nfs_end_data_update(inode);
if (dreq->commit_data != NULL) if (dreq->commit_data != NULL)
nfs_commit_free(dreq->commit_data); nfs_commit_free(dreq->commit_data);
nfs_direct_free_writedata(dreq); nfs_direct_free_writedata(dreq);
...@@ -533,7 +532,6 @@ static inline void nfs_alloc_commit_data(struct nfs_direct_req *dreq) ...@@ -533,7 +532,6 @@ static inline void nfs_alloc_commit_data(struct nfs_direct_req *dreq)
static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode) static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
{ {
nfs_end_data_update(inode);
nfs_direct_free_writedata(dreq); nfs_direct_free_writedata(dreq);
nfs_zap_mapping(inode, inode->i_mapping); nfs_zap_mapping(inode, inode->i_mapping);
nfs_direct_complete(dreq); nfs_direct_complete(dreq);
...@@ -724,8 +722,6 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz ...@@ -724,8 +722,6 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, count); nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, count);
nfs_begin_data_update(inode);
rpc_clnt_sigmask(clnt, &oldset); rpc_clnt_sigmask(clnt, &oldset);
result = nfs_direct_write_schedule(dreq, user_addr, count, pos, sync); result = nfs_direct_write_schedule(dreq, user_addr, count, pos, sync);
if (!result) if (!result)
......
...@@ -344,7 +344,6 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -344,7 +344,6 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
return 0; return 0;
lock_kernel(); lock_kernel();
nfs_begin_data_update(inode);
/* Write all dirty data */ /* Write all dirty data */
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode)) {
filemap_write_and_wait(inode->i_mapping); filemap_write_and_wait(inode->i_mapping);
...@@ -358,7 +357,6 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -358,7 +357,6 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr); error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr);
if (error == 0) if (error == 0)
nfs_refresh_inode(inode, &fattr); nfs_refresh_inode(inode, &fattr);
nfs_end_data_update(inode);
unlock_kernel(); unlock_kernel();
return error; return error;
} }
...@@ -755,23 +753,6 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) ...@@ -755,23 +753,6 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
return ret; return ret;
} }
/**
* nfs_end_data_update
* @inode - pointer to inode
* Declare end of the operations that will update file data
* This will mark the inode as immediately needing revalidation
* of its attribute cache.
*/
void nfs_end_data_update(struct inode *inode)
{
/* Directories: invalidate page cache */
if (S_ISDIR(inode->i_mode)) {
spin_lock(&inode->i_lock);
NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
spin_unlock(&inode->i_lock);
}
}
static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
{ {
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
......
...@@ -317,13 +317,11 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, ...@@ -317,13 +317,11 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
} }
dprintk("NFS call setacl\n"); dprintk("NFS call setacl\n");
nfs_begin_data_update(inode);
msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL]; msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL];
status = rpc_call_sync(server->client_acl, &msg, 0); status = rpc_call_sync(server->client_acl, &msg, 0);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS; NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS;
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
nfs_end_data_update(inode);
dprintk("NFS reply setacl: %d\n", status); dprintk("NFS reply setacl: %d\n", status);
/* pages may have been allocated at the xdr layer. */ /* pages may have been allocated at the xdr layer. */
......
...@@ -66,7 +66,6 @@ static void nfs_async_unlink_init(struct rpc_task *task, void *calldata) ...@@ -66,7 +66,6 @@ static void nfs_async_unlink_init(struct rpc_task *task, void *calldata)
.rpc_cred = data->cred, .rpc_cred = data->cred,
}; };
nfs_begin_data_update(dir);
NFS_PROTO(dir)->unlink_setup(&msg, dir); NFS_PROTO(dir)->unlink_setup(&msg, dir);
rpc_call_setup(task, &msg, 0); rpc_call_setup(task, &msg, 0);
} }
...@@ -84,8 +83,6 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata) ...@@ -84,8 +83,6 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
if (!NFS_PROTO(dir)->unlink_done(task, dir)) if (!NFS_PROTO(dir)->unlink_done(task, dir))
rpc_restart_call(task); rpc_restart_call(task);
else
nfs_end_data_update(dir);
} }
/** /**
......
...@@ -378,7 +378,6 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) ...@@ -378,7 +378,6 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
return error; return error;
if (!nfsi->npages) { if (!nfsi->npages) {
igrab(inode); igrab(inode);
nfs_begin_data_update(inode);
if (nfs_have_delegation(inode, FMODE_WRITE)) if (nfs_have_delegation(inode, FMODE_WRITE))
nfsi->change_attr++; nfsi->change_attr++;
} }
...@@ -406,7 +405,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) ...@@ -406,7 +405,6 @@ static void nfs_inode_remove_request(struct nfs_page *req)
nfsi->npages--; nfsi->npages--;
if (!nfsi->npages) { if (!nfsi->npages) {
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
nfs_end_data_update(inode);
iput(inode); iput(inode);
} else } else
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
......
...@@ -219,15 +219,6 @@ static inline struct nfs_inode *NFS_I(struct inode *inode) ...@@ -219,15 +219,6 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
#define NFS_FILEID(inode) (NFS_I(inode)->fileid) #define NFS_FILEID(inode) (NFS_I(inode)->fileid)
/**
* nfs_begin_data_update
* @inode - pointer to inode
* Declare that a set of operations will update file data on the server
*/
static inline void nfs_begin_data_update(struct inode *inode)
{
}
static inline void nfs_mark_for_revalidate(struct inode *inode) static inline void nfs_mark_for_revalidate(struct inode *inode)
{ {
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
...@@ -296,9 +287,6 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map ...@@ -296,9 +287,6 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map
extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
extern int nfs_setattr(struct dentry *, struct iattr *); extern int nfs_setattr(struct dentry *, struct iattr *);
extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
extern void nfs_begin_attr_update(struct inode *);
extern void nfs_end_attr_update(struct inode *);
extern void nfs_end_data_update(struct inode *);
extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
extern void put_nfs_open_context(struct nfs_open_context *ctx); extern void put_nfs_open_context(struct nfs_open_context *ctx);
extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment