diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 15:40:57 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 18:04:28 -0500 |
commit | 5955102c9984fa081b2d570cfac75c97eecf8f3b (patch) | |
tree | a4744386eac4b916e847eb4eedfada158f6527b4 /fs/ntfs | |
parent | 57b8f112cfe6622ddddb8c2641206bb5fa8a112d (diff) |
wrappers for ->i_mutex access
parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
inode_foo(inode) being mutex_foo(&inode->i_mutex).
Please, use those for access to ->i_mutex; over the coming cycle
->i_mutex will become rwsem, with ->lookup() done with it held
only shared.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/dir.c | 4 | ||||
-rw-r--r-- | fs/ntfs/file.c | 8 | ||||
-rw-r--r-- | fs/ntfs/quota.c | 6 | ||||
-rw-r--r-- | fs/ntfs/super.c | 12 |
4 files changed, 15 insertions, 15 deletions
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 9e38dafa3bc7..b2eff5816adc 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -1509,7 +1509,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
1509 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); | 1509 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); |
1510 | if (err) | 1510 | if (err) |
1511 | return err; | 1511 | return err; |
1512 | mutex_lock(&vi->i_mutex); | 1512 | inode_lock(vi); |
1513 | 1513 | ||
1514 | BUG_ON(!S_ISDIR(vi->i_mode)); | 1514 | BUG_ON(!S_ISDIR(vi->i_mode)); |
1515 | /* If the bitmap attribute inode is in memory sync it, too. */ | 1515 | /* If the bitmap attribute inode is in memory sync it, too. */ |
@@ -1532,7 +1532,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
1532 | else | 1532 | else |
1533 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " | 1533 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " |
1534 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); | 1534 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); |
1535 | mutex_unlock(&vi->i_mutex); | 1535 | inode_unlock(vi); |
1536 | return ret; | 1536 | return ret; |
1537 | } | 1537 | } |
1538 | 1538 | ||
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 9d383e5eff0e..bed4d427dfae 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -1944,14 +1944,14 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1944 | ssize_t written = 0; | 1944 | ssize_t written = 0; |
1945 | ssize_t err; | 1945 | ssize_t err; |
1946 | 1946 | ||
1947 | mutex_lock(&vi->i_mutex); | 1947 | inode_lock(vi); |
1948 | /* We can write back this queue in page reclaim. */ | 1948 | /* We can write back this queue in page reclaim. */ |
1949 | current->backing_dev_info = inode_to_bdi(vi); | 1949 | current->backing_dev_info = inode_to_bdi(vi); |
1950 | err = ntfs_prepare_file_for_write(iocb, from); | 1950 | err = ntfs_prepare_file_for_write(iocb, from); |
1951 | if (iov_iter_count(from) && !err) | 1951 | if (iov_iter_count(from) && !err) |
1952 | written = ntfs_perform_write(file, from, iocb->ki_pos); | 1952 | written = ntfs_perform_write(file, from, iocb->ki_pos); |
1953 | current->backing_dev_info = NULL; | 1953 | current->backing_dev_info = NULL; |
1954 | mutex_unlock(&vi->i_mutex); | 1954 | inode_unlock(vi); |
1955 | if (likely(written > 0)) { | 1955 | if (likely(written > 0)) { |
1956 | err = generic_write_sync(file, iocb->ki_pos, written); | 1956 | err = generic_write_sync(file, iocb->ki_pos, written); |
1957 | if (err < 0) | 1957 | if (err < 0) |
@@ -1996,7 +1996,7 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
1996 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); | 1996 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); |
1997 | if (err) | 1997 | if (err) |
1998 | return err; | 1998 | return err; |
1999 | mutex_lock(&vi->i_mutex); | 1999 | inode_lock(vi); |
2000 | 2000 | ||
2001 | BUG_ON(S_ISDIR(vi->i_mode)); | 2001 | BUG_ON(S_ISDIR(vi->i_mode)); |
2002 | if (!datasync || !NInoNonResident(NTFS_I(vi))) | 2002 | if (!datasync || !NInoNonResident(NTFS_I(vi))) |
@@ -2015,7 +2015,7 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
2015 | else | 2015 | else |
2016 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " | 2016 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " |
2017 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); | 2017 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); |
2018 | mutex_unlock(&vi->i_mutex); | 2018 | inode_unlock(vi); |
2019 | return ret; | 2019 | return ret; |
2020 | } | 2020 | } |
2021 | 2021 | ||
diff --git a/fs/ntfs/quota.c b/fs/ntfs/quota.c index d80e3315cab0..9793e68ba1dd 100644 --- a/fs/ntfs/quota.c +++ b/fs/ntfs/quota.c | |||
@@ -48,7 +48,7 @@ bool ntfs_mark_quotas_out_of_date(ntfs_volume *vol) | |||
48 | ntfs_error(vol->sb, "Quota inodes are not open."); | 48 | ntfs_error(vol->sb, "Quota inodes are not open."); |
49 | return false; | 49 | return false; |
50 | } | 50 | } |
51 | mutex_lock(&vol->quota_q_ino->i_mutex); | 51 | inode_lock(vol->quota_q_ino); |
52 | ictx = ntfs_index_ctx_get(NTFS_I(vol->quota_q_ino)); | 52 | ictx = ntfs_index_ctx_get(NTFS_I(vol->quota_q_ino)); |
53 | if (!ictx) { | 53 | if (!ictx) { |
54 | ntfs_error(vol->sb, "Failed to get index context."); | 54 | ntfs_error(vol->sb, "Failed to get index context."); |
@@ -98,7 +98,7 @@ bool ntfs_mark_quotas_out_of_date(ntfs_volume *vol) | |||
98 | ntfs_index_entry_mark_dirty(ictx); | 98 | ntfs_index_entry_mark_dirty(ictx); |
99 | set_done: | 99 | set_done: |
100 | ntfs_index_ctx_put(ictx); | 100 | ntfs_index_ctx_put(ictx); |
101 | mutex_unlock(&vol->quota_q_ino->i_mutex); | 101 | inode_unlock(vol->quota_q_ino); |
102 | /* | 102 | /* |
103 | * We set the flag so we do not try to mark the quotas out of date | 103 | * We set the flag so we do not try to mark the quotas out of date |
104 | * again on remount. | 104 | * again on remount. |
@@ -110,7 +110,7 @@ done: | |||
110 | err_out: | 110 | err_out: |
111 | if (ictx) | 111 | if (ictx) |
112 | ntfs_index_ctx_put(ictx); | 112 | ntfs_index_ctx_put(ictx); |
113 | mutex_unlock(&vol->quota_q_ino->i_mutex); | 113 | inode_unlock(vol->quota_q_ino); |
114 | return false; | 114 | return false; |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 2f77f8dfb861..1b38abdaa3ed 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -1284,10 +1284,10 @@ static int check_windows_hibernation_status(ntfs_volume *vol) | |||
1284 | * Find the inode number for the hibernation file by looking up the | 1284 | * Find the inode number for the hibernation file by looking up the |
1285 | * filename hiberfil.sys in the root directory. | 1285 | * filename hiberfil.sys in the root directory. |
1286 | */ | 1286 | */ |
1287 | mutex_lock(&vol->root_ino->i_mutex); | 1287 | inode_lock(vol->root_ino); |
1288 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->root_ino), hiberfil, 12, | 1288 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->root_ino), hiberfil, 12, |
1289 | &name); | 1289 | &name); |
1290 | mutex_unlock(&vol->root_ino->i_mutex); | 1290 | inode_unlock(vol->root_ino); |
1291 | if (IS_ERR_MREF(mref)) { | 1291 | if (IS_ERR_MREF(mref)) { |
1292 | ret = MREF_ERR(mref); | 1292 | ret = MREF_ERR(mref); |
1293 | /* If the file does not exist, Windows is not hibernated. */ | 1293 | /* If the file does not exist, Windows is not hibernated. */ |
@@ -1377,10 +1377,10 @@ static bool load_and_init_quota(ntfs_volume *vol) | |||
1377 | * Find the inode number for the quota file by looking up the filename | 1377 | * Find the inode number for the quota file by looking up the filename |
1378 | * $Quota in the extended system files directory $Extend. | 1378 | * $Quota in the extended system files directory $Extend. |
1379 | */ | 1379 | */ |
1380 | mutex_lock(&vol->extend_ino->i_mutex); | 1380 | inode_lock(vol->extend_ino); |
1381 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), Quota, 6, | 1381 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), Quota, 6, |
1382 | &name); | 1382 | &name); |
1383 | mutex_unlock(&vol->extend_ino->i_mutex); | 1383 | inode_unlock(vol->extend_ino); |
1384 | if (IS_ERR_MREF(mref)) { | 1384 | if (IS_ERR_MREF(mref)) { |
1385 | /* | 1385 | /* |
1386 | * If the file does not exist, quotas are disabled and have | 1386 | * If the file does not exist, quotas are disabled and have |
@@ -1460,10 +1460,10 @@ static bool load_and_init_usnjrnl(ntfs_volume *vol) | |||
1460 | * Find the inode number for the transaction log file by looking up the | 1460 | * Find the inode number for the transaction log file by looking up the |
1461 | * filename $UsnJrnl in the extended system files directory $Extend. | 1461 | * filename $UsnJrnl in the extended system files directory $Extend. |
1462 | */ | 1462 | */ |
1463 | mutex_lock(&vol->extend_ino->i_mutex); | 1463 | inode_lock(vol->extend_ino); |
1464 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), UsnJrnl, 8, | 1464 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), UsnJrnl, 8, |
1465 | &name); | 1465 | &name); |
1466 | mutex_unlock(&vol->extend_ino->i_mutex); | 1466 | inode_unlock(vol->extend_ino); |
1467 | if (IS_ERR_MREF(mref)) { | 1467 | if (IS_ERR_MREF(mref)) { |
1468 | /* | 1468 | /* |
1469 | * If the file does not exist, transaction logging is disabled, | 1469 | * If the file does not exist, transaction logging is disabled, |