aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r--fs/ocfs2/file.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 77b4c04a280..bdadbae0909 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1307,10 +1307,13 @@ bail:
1307 return err; 1307 return err;
1308} 1308}
1309 1309
1310int ocfs2_permission(struct inode *inode, int mask) 1310int ocfs2_permission(struct inode *inode, int mask, unsigned int flags)
1311{ 1311{
1312 int ret; 1312 int ret;
1313 1313
1314 if (flags & IPERM_FLAG_RCU)
1315 return -ECHILD;
1316
1314 mlog_entry_void(); 1317 mlog_entry_void();
1315 1318
1316 ret = ocfs2_inode_lock(inode, NULL, 0); 1319 ret = ocfs2_inode_lock(inode, NULL, 0);
@@ -1320,7 +1323,7 @@ int ocfs2_permission(struct inode *inode, int mask)
1320 goto out; 1323 goto out;
1321 } 1324 }
1322 1325
1323 ret = generic_permission(inode, mask, ocfs2_check_acl); 1326 ret = generic_permission(inode, mask, flags, ocfs2_check_acl);
1324 1327
1325 ocfs2_inode_unlock(inode, 0); 1328 ocfs2_inode_unlock(inode, 0);
1326out: 1329out:
@@ -2241,11 +2244,15 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
2241 2244
2242 mutex_lock(&inode->i_mutex); 2245 mutex_lock(&inode->i_mutex);
2243 2246
2247 ocfs2_iocb_clear_sem_locked(iocb);
2248
2244relock: 2249relock:
2245 /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ 2250 /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */
2246 if (direct_io) { 2251 if (direct_io) {
2247 down_read(&inode->i_alloc_sem); 2252 down_read(&inode->i_alloc_sem);
2248 have_alloc_sem = 1; 2253 have_alloc_sem = 1;
2254 /* communicate with ocfs2_dio_end_io */
2255 ocfs2_iocb_set_sem_locked(iocb);
2249 } 2256 }
2250 2257
2251 /* 2258 /*
@@ -2382,8 +2389,10 @@ out:
2382 ocfs2_rw_unlock(inode, rw_level); 2389 ocfs2_rw_unlock(inode, rw_level);
2383 2390
2384out_sems: 2391out_sems:
2385 if (have_alloc_sem) 2392 if (have_alloc_sem) {
2386 up_read(&inode->i_alloc_sem); 2393 up_read(&inode->i_alloc_sem);
2394 ocfs2_iocb_clear_sem_locked(iocb);
2395 }
2387 2396
2388 mutex_unlock(&inode->i_mutex); 2397 mutex_unlock(&inode->i_mutex);
2389 2398
@@ -2527,6 +2536,8 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
2527 goto bail; 2536 goto bail;
2528 } 2537 }
2529 2538
2539 ocfs2_iocb_clear_sem_locked(iocb);
2540
2530 /* 2541 /*
2531 * buffered reads protect themselves in ->readpage(). O_DIRECT reads 2542 * buffered reads protect themselves in ->readpage(). O_DIRECT reads
2532 * need locks to protect pending reads from racing with truncate. 2543 * need locks to protect pending reads from racing with truncate.
@@ -2534,6 +2545,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
2534 if (filp->f_flags & O_DIRECT) { 2545 if (filp->f_flags & O_DIRECT) {
2535 down_read(&inode->i_alloc_sem); 2546 down_read(&inode->i_alloc_sem);
2536 have_alloc_sem = 1; 2547 have_alloc_sem = 1;
2548 ocfs2_iocb_set_sem_locked(iocb);
2537 2549
2538 ret = ocfs2_rw_lock(inode, 0); 2550 ret = ocfs2_rw_lock(inode, 0);
2539 if (ret < 0) { 2551 if (ret < 0) {
@@ -2575,8 +2587,10 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
2575 } 2587 }
2576 2588
2577bail: 2589bail:
2578 if (have_alloc_sem) 2590 if (have_alloc_sem) {
2579 up_read(&inode->i_alloc_sem); 2591 up_read(&inode->i_alloc_sem);
2592 ocfs2_iocb_clear_sem_locked(iocb);
2593 }
2580 if (rw_level != -1) 2594 if (rw_level != -1)
2581 ocfs2_rw_unlock(inode, rw_level); 2595 ocfs2_rw_unlock(inode, rw_level);
2582 mlog_exit(ret); 2596 mlog_exit(ret);