aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-01-22 15:40:57 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-01-22 18:04:28 -0500
commit5955102c9984fa081b2d570cfac75c97eecf8f3b (patch)
treea4744386eac4b916e847eb4eedfada158f6527b4 /fs/ceph
parent57b8f112cfe6622ddddb8c2641206bb5fa8a112d (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/ceph')
-rw-r--r--fs/ceph/cache.c4
-rw-r--r--fs/ceph/caps.c4
-rw-r--r--fs/ceph/dir.c4
-rw-r--r--fs/ceph/export.c4
-rw-r--r--fs/ceph/file.c18
5 files changed, 17 insertions, 17 deletions
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c
index a4766ded1ba7..7680e2626815 100644
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -197,7 +197,7 @@ void ceph_fscache_register_inode_cookie(struct ceph_fs_client* fsc,
197 return; 197 return;
198 198
199 /* Avoid multiple racing open requests */ 199 /* Avoid multiple racing open requests */
200 mutex_lock(&inode->i_mutex); 200 inode_lock(inode);
201 201
202 if (ci->fscache) 202 if (ci->fscache)
203 goto done; 203 goto done;
@@ -207,7 +207,7 @@ void ceph_fscache_register_inode_cookie(struct ceph_fs_client* fsc,
207 ci, true); 207 ci, true);
208 fscache_check_consistency(ci->fscache); 208 fscache_check_consistency(ci->fscache);
209done: 209done:
210 mutex_unlock(&inode->i_mutex); 210 inode_unlock(inode);
211 211
212} 212}
213 213
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index c69e1253b47b..cdbf8cf3d52c 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2030,7 +2030,7 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2030 if (datasync) 2030 if (datasync)
2031 goto out; 2031 goto out;
2032 2032
2033 mutex_lock(&inode->i_mutex); 2033 inode_lock(inode);
2034 2034
2035 dirty = try_flush_caps(inode, &flush_tid); 2035 dirty = try_flush_caps(inode, &flush_tid);
2036 dout("fsync dirty caps are %s\n", ceph_cap_string(dirty)); 2036 dout("fsync dirty caps are %s\n", ceph_cap_string(dirty));
@@ -2046,7 +2046,7 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2046 ret = wait_event_interruptible(ci->i_cap_wq, 2046 ret = wait_event_interruptible(ci->i_cap_wq,
2047 caps_are_flushed(inode, flush_tid)); 2047 caps_are_flushed(inode, flush_tid));
2048 } 2048 }
2049 mutex_unlock(&inode->i_mutex); 2049 inode_unlock(inode);
2050out: 2050out:
2051 dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret); 2051 dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret);
2052 return ret; 2052 return ret;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 9314b4ea2375..fd11fb231a2e 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -507,7 +507,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
507 loff_t old_offset = ceph_make_fpos(fi->frag, fi->next_offset); 507 loff_t old_offset = ceph_make_fpos(fi->frag, fi->next_offset);
508 loff_t retval; 508 loff_t retval;
509 509
510 mutex_lock(&inode->i_mutex); 510 inode_lock(inode);
511 retval = -EINVAL; 511 retval = -EINVAL;
512 switch (whence) { 512 switch (whence) {
513 case SEEK_CUR: 513 case SEEK_CUR:
@@ -542,7 +542,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
542 } 542 }
543 } 543 }
544out: 544out:
545 mutex_unlock(&inode->i_mutex); 545 inode_unlock(inode);
546 return retval; 546 return retval;
547} 547}
548 548
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index fe02ae7f056a..3b3172357326 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -215,7 +215,7 @@ static int ceph_get_name(struct dentry *parent, char *name,
215 if (IS_ERR(req)) 215 if (IS_ERR(req))
216 return PTR_ERR(req); 216 return PTR_ERR(req);
217 217
218 mutex_lock(&d_inode(parent)->i_mutex); 218 inode_lock(d_inode(parent));
219 219
220 req->r_inode = d_inode(child); 220 req->r_inode = d_inode(child);
221 ihold(d_inode(child)); 221 ihold(d_inode(child));
@@ -224,7 +224,7 @@ static int ceph_get_name(struct dentry *parent, char *name,
224 req->r_num_caps = 2; 224 req->r_num_caps = 2;
225 err = ceph_mdsc_do_request(mdsc, NULL, req); 225 err = ceph_mdsc_do_request(mdsc, NULL, req);
226 226
227 mutex_unlock(&d_inode(parent)->i_mutex); 227 inode_unlock(d_inode(parent));
228 228
229 if (!err) { 229 if (!err) {
230 struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; 230 struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 3c68e6aee2f0..10c5ae79696e 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1014,7 +1014,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
1014 if (!prealloc_cf) 1014 if (!prealloc_cf)
1015 return -ENOMEM; 1015 return -ENOMEM;
1016 1016
1017 mutex_lock(&inode->i_mutex); 1017 inode_lock(inode);
1018 1018
1019 /* We can write back this queue in page reclaim */ 1019 /* We can write back this queue in page reclaim */
1020 current->backing_dev_info = inode_to_bdi(inode); 1020 current->backing_dev_info = inode_to_bdi(inode);
@@ -1070,7 +1070,7 @@ retry_snap:
1070 (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { 1070 (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) {
1071 struct ceph_snap_context *snapc; 1071 struct ceph_snap_context *snapc;
1072 struct iov_iter data; 1072 struct iov_iter data;
1073 mutex_unlock(&inode->i_mutex); 1073 inode_unlock(inode);
1074 1074
1075 spin_lock(&ci->i_ceph_lock); 1075 spin_lock(&ci->i_ceph_lock);
1076 if (__ceph_have_pending_cap_snap(ci)) { 1076 if (__ceph_have_pending_cap_snap(ci)) {
@@ -1097,7 +1097,7 @@ retry_snap:
1097 "got EOLDSNAPC, retrying\n", 1097 "got EOLDSNAPC, retrying\n",
1098 inode, ceph_vinop(inode), 1098 inode, ceph_vinop(inode),
1099 pos, (unsigned)count); 1099 pos, (unsigned)count);
1100 mutex_lock(&inode->i_mutex); 1100 inode_lock(inode);
1101 goto retry_snap; 1101 goto retry_snap;
1102 } 1102 }
1103 if (written > 0) 1103 if (written > 0)
@@ -1117,7 +1117,7 @@ retry_snap:
1117 iocb->ki_pos = pos + written; 1117 iocb->ki_pos = pos + written;
1118 if (inode->i_size > old_size) 1118 if (inode->i_size > old_size)
1119 ceph_fscache_update_objectsize(inode); 1119 ceph_fscache_update_objectsize(inode);
1120 mutex_unlock(&inode->i_mutex); 1120 inode_unlock(inode);
1121 } 1121 }
1122 1122
1123 if (written >= 0) { 1123 if (written >= 0) {
@@ -1147,7 +1147,7 @@ retry_snap:
1147 goto out_unlocked; 1147 goto out_unlocked;
1148 1148
1149out: 1149out:
1150 mutex_unlock(&inode->i_mutex); 1150 inode_unlock(inode);
1151out_unlocked: 1151out_unlocked:
1152 ceph_free_cap_flush(prealloc_cf); 1152 ceph_free_cap_flush(prealloc_cf);
1153 current->backing_dev_info = NULL; 1153 current->backing_dev_info = NULL;
@@ -1162,7 +1162,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
1162 struct inode *inode = file->f_mapping->host; 1162 struct inode *inode = file->f_mapping->host;
1163 int ret; 1163 int ret;
1164 1164
1165 mutex_lock(&inode->i_mutex); 1165 inode_lock(inode);
1166 1166
1167 if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { 1167 if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
1168 ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); 1168 ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false);
@@ -1207,7 +1207,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
1207 offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); 1207 offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
1208 1208
1209out: 1209out:
1210 mutex_unlock(&inode->i_mutex); 1210 inode_unlock(inode);
1211 return offset; 1211 return offset;
1212} 1212}
1213 1213
@@ -1363,7 +1363,7 @@ static long ceph_fallocate(struct file *file, int mode,
1363 if (!prealloc_cf) 1363 if (!prealloc_cf)
1364 return -ENOMEM; 1364 return -ENOMEM;
1365 1365
1366 mutex_lock(&inode->i_mutex); 1366 inode_lock(inode);
1367 1367
1368 if (ceph_snap(inode) != CEPH_NOSNAP) { 1368 if (ceph_snap(inode) != CEPH_NOSNAP) {
1369 ret = -EROFS; 1369 ret = -EROFS;
@@ -1418,7 +1418,7 @@ static long ceph_fallocate(struct file *file, int mode,
1418 1418
1419 ceph_put_cap_refs(ci, got); 1419 ceph_put_cap_refs(ci, got);
1420unlock: 1420unlock:
1421 mutex_unlock(&inode->i_mutex); 1421 inode_unlock(inode);
1422 ceph_free_cap_flush(prealloc_cf); 1422 ceph_free_cap_flush(prealloc_cf);
1423 return ret; 1423 return ret;
1424} 1424}