Skip to contentSkip to conversation

Unlock page on prepare_write try lock failure

Cluster-devel Steven Whitehouse 2 participants 2 messages Feb 7, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

From 2d72e7101cc7fff5c1eb21bfcbba51c8002418d2 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Wed, 7 Feb 2007 10:25:59 -0500
Subject: [PATCH] [GFS2] Unlock page on prepare_write try lock failure

When the try lock of the glock failed in prepare_write we were incorrectly exiting this function with the page still locked. This was resulting in further I/O to this page hanging.

fs/gfs2/ops_address.c +3 -1
index 9ddf975..5e9653c 100644
@@ -360,8 +360,10 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
 	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|LM_FLAG_TRY_1CB, &ip->i_gh);
 	error = gfs2_glock_nq_atime(&ip->i_gh);
 	if (unlikely(error)) {
-		if (error == GLR_TRYFAILED)
+		if (error == GLR_TRYFAILED) {
+			unlock_page(page);
 			error = AOP_TRUNCATED_PAGE;
+		}
 		goto out_uninit;
 	}
 
Signature · 1 line
1.4.4.2
#1 lore raw
Quoted 8 lines · Steven Whitehouse
Quoted 1 line

From 2d72e7101cc7fff5c1eb21bfcbba51c8002418d2 Mon Sep 17 00:00:00 2001

From: Steven Whitehouse <[email protected]>
Date: Wed, 7 Feb 2007 10:25:59 -0500
Subject: [PATCH] [GFS2] Unlock page on prepare_write try lock failure

When the try lock of the glock failed in prepare_write we were incorrectly exiting this function with the page still locked. This was resulting in further I/O to this page hanging.

Ha! .. I'm in the middle of debugging this issue (taking a break by reading my mail :)) - was wondering why that lock disappeared ...

-- Wendy