diff options
-rw-r--r-- | fs/gfs2/glock.h | 1 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index b9856274df59..a331bf8175ea 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #define GL_ATIME 0x00000200 | 27 | #define GL_ATIME 0x00000200 |
28 | #define GL_NOCACHE 0x00000400 | 28 | #define GL_NOCACHE 0x00000400 |
29 | #define GL_NOCANCEL 0x00001000 | 29 | #define GL_NOCANCEL 0x00001000 |
30 | #define GL_AOP 0x00004000 | ||
31 | 30 | ||
32 | #define GLR_TRYFAILED 13 | 31 | #define GLR_TRYFAILED 13 |
33 | #define GLR_CANCELED 14 | 32 | #define GLR_CANCELED 14 |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 5c3962c80e88..3822189454a3 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -230,7 +230,7 @@ static int gfs2_readpage(struct file *file, struct page *page) | |||
230 | /* gfs2_sharewrite_nopage has grabbed the ip->i_gl already */ | 230 | /* gfs2_sharewrite_nopage has grabbed the ip->i_gl already */ |
231 | goto skip_lock; | 231 | goto skip_lock; |
232 | } | 232 | } |
233 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|GL_AOP, &gh); | 233 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh); |
234 | do_unlock = 1; | 234 | do_unlock = 1; |
235 | error = gfs2_glock_nq_m_atime(1, &gh); | 235 | error = gfs2_glock_nq_m_atime(1, &gh); |
236 | if (unlikely(error)) | 236 | if (unlikely(error)) |
@@ -254,6 +254,8 @@ skip_lock: | |||
254 | out: | 254 | out: |
255 | return error; | 255 | return error; |
256 | out_unlock: | 256 | out_unlock: |
257 | if (error == GLR_TRYFAILED) | ||
258 | error = AOP_TRUNCATED_PAGE; | ||
257 | unlock_page(page); | 259 | unlock_page(page); |
258 | if (do_unlock) | 260 | if (do_unlock) |
259 | gfs2_holder_uninit(&gh); | 261 | gfs2_holder_uninit(&gh); |
@@ -293,7 +295,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping, | |||
293 | goto skip_lock; | 295 | goto skip_lock; |
294 | } | 296 | } |
295 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, | 297 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, |
296 | LM_FLAG_TRY_1CB|GL_ATIME|GL_AOP, &gh); | 298 | LM_FLAG_TRY_1CB|GL_ATIME, &gh); |
297 | do_unlock = 1; | 299 | do_unlock = 1; |
298 | ret = gfs2_glock_nq_m_atime(1, &gh); | 300 | ret = gfs2_glock_nq_m_atime(1, &gh); |
299 | if (ret == GLR_TRYFAILED) | 301 | if (ret == GLR_TRYFAILED) |
@@ -366,10 +368,13 @@ static int gfs2_prepare_write(struct file *file, struct page *page, | |||
366 | unsigned int write_len = to - from; | 368 | unsigned int write_len = to - from; |
367 | 369 | ||
368 | 370 | ||
369 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh); | 371 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|LM_FLAG_TRY_1CB, &ip->i_gh); |
370 | error = gfs2_glock_nq_m_atime(1, &ip->i_gh); | 372 | error = gfs2_glock_nq_m_atime(1, &ip->i_gh); |
371 | if (error) | 373 | if (unlikely(error)) { |
374 | if (error == GLR_TRYFAILED) | ||
375 | error = AOP_TRUNCATED_PAGE; | ||
372 | goto out_uninit; | 376 | goto out_uninit; |
377 | } | ||
373 | 378 | ||
374 | gfs2_write_calc_reserv(ip, write_len, &data_blocks, &ind_blocks); | 379 | gfs2_write_calc_reserv(ip, write_len, &data_blocks, &ind_blocks); |
375 | 380 | ||