Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101152
b: refs/heads/master
c: 01b7c7a
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Jun 27, 2008
1 parent 9c5bb86 commit 8895a7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80274737220f8c5ea75696dde4c5c7feba39456f
refs/heads/master: 01b7c7ae88a6376c508b35a22bb61e04cb1b37f0
29 changes: 16 additions & 13 deletions trunk/fs/gfs2/ops_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,31 +499,34 @@ static int __gfs2_readpage(void *file, struct page *page)
* @file: The file to read
* @page: The page of the file
*
* This deals with the locking required. We use a trylock in order to
* avoid the page lock / glock ordering problems returning AOP_TRUNCATED_PAGE
* in the event that we are unable to get the lock.
* This deals with the locking required. We have to unlock and
* relock the page in order to get the locking in the right
* order.
*/

static int gfs2_readpage(struct file *file, struct page *page)
{
struct gfs2_inode *ip = GFS2_I(page->mapping->host);
struct address_space *mapping = page->mapping;
struct gfs2_inode *ip = GFS2_I(mapping->host);
struct gfs2_holder gh;
int error;

gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh);
unlock_page(page);
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
error = gfs2_glock_nq_atime(&gh);
if (unlikely(error)) {
unlock_page(page);
if (unlikely(error))
goto out;
}
error = __gfs2_readpage(file, page);
error = AOP_TRUNCATED_PAGE;
lock_page(page);
if (page->mapping == mapping && !PageUptodate(page))
error = __gfs2_readpage(file, page);
else
unlock_page(page);
gfs2_glock_dq(&gh);
out:
gfs2_holder_uninit(&gh);
if (error == GLR_TRYFAILED) {
yield();
return AOP_TRUNCATED_PAGE;
}
if (error && error != AOP_TRUNCATED_PAGE)
lock_page(page);
return error;
}

Expand Down

0 comments on commit 8895a7e

Please sign in to comment.