aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index a03ed2f85047..34da48586829 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1001,12 +1001,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
1001 goto out; 1001 goto out;
1002 } 1002 }
1003 1003
1004 if (nd->intent.open.flags & O_CREAT) { 1004 res = nfs4_atomic_open(dir, dentry, nd);
1005 nfs_begin_data_update(dir);
1006 res = nfs4_atomic_open(dir, dentry, nd);
1007 nfs_end_data_update(dir);
1008 } else
1009 res = nfs4_atomic_open(dir, dentry, nd);
1010 unlock_kernel(); 1005 unlock_kernel();
1011 if (IS_ERR(res)) { 1006 if (IS_ERR(res)) {
1012 error = PTR_ERR(res); 1007 error = PTR_ERR(res);
@@ -1224,9 +1219,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode,
1224 open_flags = nd->intent.open.flags; 1219 open_flags = nd->intent.open.flags;
1225 1220
1226 lock_kernel(); 1221 lock_kernel();
1227 nfs_begin_data_update(dir);
1228 error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, nd); 1222 error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, nd);
1229 nfs_end_data_update(dir);
1230 if (error != 0) 1223 if (error != 0)
1231 goto out_err; 1224 goto out_err;
1232 unlock_kernel(); 1225 unlock_kernel();
@@ -1256,9 +1249,7 @@ nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1256 attr.ia_valid = ATTR_MODE; 1249 attr.ia_valid = ATTR_MODE;
1257 1250
1258 lock_kernel(); 1251 lock_kernel();
1259 nfs_begin_data_update(dir);
1260 status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev); 1252 status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev);
1261 nfs_end_data_update(dir);
1262 if (status != 0) 1253 if (status != 0)
1263 goto out_err; 1254 goto out_err;
1264 unlock_kernel(); 1255 unlock_kernel();
@@ -1284,9 +1275,7 @@ static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1284 attr.ia_mode = mode | S_IFDIR; 1275 attr.ia_mode = mode | S_IFDIR;
1285 1276
1286 lock_kernel(); 1277 lock_kernel();
1287 nfs_begin_data_update(dir);
1288 error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr); 1278 error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr);
1289 nfs_end_data_update(dir);
1290 if (error != 0) 1279 if (error != 0)
1291 goto out_err; 1280 goto out_err;
1292 unlock_kernel(); 1281 unlock_kernel();
@@ -1305,12 +1294,10 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry)
1305 dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); 1294 dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
1306 1295
1307 lock_kernel(); 1296 lock_kernel();
1308 nfs_begin_data_update(dir);
1309 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); 1297 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
1310 /* Ensure the VFS deletes this inode */ 1298 /* Ensure the VFS deletes this inode */
1311 if (error == 0 && dentry->d_inode != NULL) 1299 if (error == 0 && dentry->d_inode != NULL)
1312 clear_nlink(dentry->d_inode); 1300 clear_nlink(dentry->d_inode);
1313 nfs_end_data_update(dir);
1314 unlock_kernel(); 1301 unlock_kernel();
1315 1302
1316 return error; 1303 return error;
@@ -1368,17 +1355,13 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
1368 1355
1369 qsilly.name = silly; 1356 qsilly.name = silly;
1370 qsilly.len = strlen(silly); 1357 qsilly.len = strlen(silly);
1371 nfs_begin_data_update(dir);
1372 if (dentry->d_inode) { 1358 if (dentry->d_inode) {
1373 nfs_begin_data_update(dentry->d_inode);
1374 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, 1359 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name,
1375 dir, &qsilly); 1360 dir, &qsilly);
1376 nfs_mark_for_revalidate(dentry->d_inode); 1361 nfs_mark_for_revalidate(dentry->d_inode);
1377 nfs_end_data_update(dentry->d_inode);
1378 } else 1362 } else
1379 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, 1363 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name,
1380 dir, &qsilly); 1364 dir, &qsilly);
1381 nfs_end_data_update(dir);
1382 if (!error) { 1365 if (!error) {
1383 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1366 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1384 d_move(dentry, sdentry); 1367 d_move(dentry, sdentry);
@@ -1412,19 +1395,15 @@ static int nfs_safe_remove(struct dentry *dentry)
1412 goto out; 1395 goto out;
1413 } 1396 }
1414 1397
1415 nfs_begin_data_update(dir);
1416 if (inode != NULL) { 1398 if (inode != NULL) {
1417 nfs_inode_return_delegation(inode); 1399 nfs_inode_return_delegation(inode);
1418 nfs_begin_data_update(inode);
1419 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); 1400 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1420 /* The VFS may want to delete this inode */ 1401 /* The VFS may want to delete this inode */
1421 if (error == 0) 1402 if (error == 0)
1422 drop_nlink(inode); 1403 drop_nlink(inode);
1423 nfs_mark_for_revalidate(inode); 1404 nfs_mark_for_revalidate(inode);
1424 nfs_end_data_update(inode);
1425 } else 1405 } else
1426 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); 1406 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1427 nfs_end_data_update(dir);
1428out: 1407out:
1429 return error; 1408 return error;
1430} 1409}
@@ -1516,9 +1495,7 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym
1516 memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen); 1495 memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen);
1517 kunmap_atomic(kaddr, KM_USER0); 1496 kunmap_atomic(kaddr, KM_USER0);
1518 1497
1519 nfs_begin_data_update(dir);
1520 error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); 1498 error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr);
1521 nfs_end_data_update(dir);
1522 if (error != 0) { 1499 if (error != 0) {
1523 dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n", 1500 dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n",
1524 dir->i_sb->s_id, dir->i_ino, 1501 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 dentry->d_parent->d_name.name, dentry->d_name.name); 1535 dentry->d_parent->d_name.name, dentry->d_name.name);
1559 1536
1560 lock_kernel(); 1537 lock_kernel();
1561 nfs_begin_data_update(dir);
1562 nfs_begin_data_update(inode);
1563 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); 1538 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
1564 if (error == 0) { 1539 if (error == 0) {
1565 atomic_inc(&inode->i_count); 1540 atomic_inc(&inode->i_count);
1566 d_instantiate(dentry, inode); 1541 d_instantiate(dentry, inode);
1567 } 1542 }
1568 nfs_end_data_update(inode);
1569 nfs_end_data_update(dir);
1570 unlock_kernel(); 1543 unlock_kernel();
1571 return error; 1544 return error;
1572} 1545}
@@ -1669,15 +1642,9 @@ go_ahead:
1669 d_delete(new_dentry); 1642 d_delete(new_dentry);
1670 } 1643 }
1671 1644
1672 nfs_begin_data_update(old_dir);
1673 nfs_begin_data_update(new_dir);
1674 nfs_begin_data_update(old_inode);
1675 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, 1645 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name,
1676 new_dir, &new_dentry->d_name); 1646 new_dir, &new_dentry->d_name);
1677 nfs_mark_for_revalidate(old_inode); 1647 nfs_mark_for_revalidate(old_inode);
1678 nfs_end_data_update(old_inode);
1679 nfs_end_data_update(new_dir);
1680 nfs_end_data_update(old_dir);
1681out: 1648out:
1682 if (rehash) 1649 if (rehash)
1683 d_rehash(rehash); 1650 d_rehash(rehash);