aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2005-09-20 15:58:11 -0400
committerDave Kleikamp <shaggy@austin.ibm.com>2005-09-20 15:58:11 -0400
commit438282d85de2c8f8c5183fdf55140e51a0b18670 (patch)
treeee90f834ebbf60d45b11d48c4a3fac82a1b62752 /fs
parent6cb1269b9607649b5edf1c4e7818e0cf34a9db71 (diff)
JFS: don't dereference tlck->ip from txUpdateMap
The inode pointer may no longer be valid Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_txnmgr.c9
-rw-r--r--fs/jfs/jfs_txnmgr.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 8132fce80993..9b71ed2674fe 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -725,6 +725,9 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
725 else 725 else
726 tlck->flag = tlckINODELOCK; 726 tlck->flag = tlckINODELOCK;
727 727
728 if (S_ISDIR(ip->i_mode))
729 tlck->flag |= tlckDIRECTORY;
730
728 tlck->type = 0; 731 tlck->type = 0;
729 732
730 /* bind the tlock and the page */ 733 /* bind the tlock and the page */
@@ -1009,6 +1012,8 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type)
1009 1012
1010 /* bind the tlock and the object */ 1013 /* bind the tlock and the object */
1011 tlck->flag = tlckINODELOCK; 1014 tlck->flag = tlckINODELOCK;
1015 if (S_ISDIR(ip->i_mode))
1016 tlck->flag |= tlckDIRECTORY;
1012 tlck->ip = ip; 1017 tlck->ip = ip;
1013 tlck->mp = NULL; 1018 tlck->mp = NULL;
1014 1019
@@ -1077,6 +1082,8 @@ struct linelock *txLinelock(struct linelock * tlock)
1077 linelock->flag = tlckLINELOCK; 1082 linelock->flag = tlckLINELOCK;
1078 linelock->maxcnt = TLOCKLONG; 1083 linelock->maxcnt = TLOCKLONG;
1079 linelock->index = 0; 1084 linelock->index = 0;
1085 if (tlck->flag & tlckDIRECTORY)
1086 linelock->flag |= tlckDIRECTORY;
1080 1087
1081 /* append linelock after tlock */ 1088 /* append linelock after tlock */
1082 linelock->next = tlock->next; 1089 linelock->next = tlock->next;
@@ -2358,7 +2365,7 @@ static void txUpdateMap(struct tblock * tblk)
2358 */ 2365 */
2359 else { /* (maplock->flag & mlckFREE) */ 2366 else { /* (maplock->flag & mlckFREE) */
2360 2367
2361 if (S_ISDIR(tlck->ip->i_mode)) 2368 if (tlck->flag & tlckDIRECTORY)
2362 txFreeMap(ipimap, maplock, 2369 txFreeMap(ipimap, maplock,
2363 tblk, COMMIT_PWMAP); 2370 tblk, COMMIT_PWMAP);
2364 else 2371 else
diff --git a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h
index 59ad0f6b7231..0e4dc4514c47 100644
--- a/fs/jfs/jfs_txnmgr.h
+++ b/fs/jfs/jfs_txnmgr.h
@@ -122,6 +122,7 @@ extern struct tlock *TxLock; /* transaction lock table */
122#define tlckLOG 0x0800 122#define tlckLOG 0x0800
123/* updateMap state */ 123/* updateMap state */
124#define tlckUPDATEMAP 0x0080 124#define tlckUPDATEMAP 0x0080
125#define tlckDIRECTORY 0x0040
125/* freeLock state */ 126/* freeLock state */
126#define tlckFREELOCK 0x0008 127#define tlckFREELOCK 0x0008
127#define tlckWRITEPAGE 0x0004 128#define tlckWRITEPAGE 0x0004