Skip to content

Commit

Permalink
JFS: don't dereference tlck->ip from txUpdateMap
Browse files Browse the repository at this point in the history
The inode pointer may no longer be valid

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
  • Loading branch information
Dave Kleikamp committed Sep 20, 2005
1 parent 6cb1269 commit 438282d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fs/jfs/jfs_txnmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp,
else
tlck->flag = tlckINODELOCK;

if (S_ISDIR(ip->i_mode))
tlck->flag |= tlckDIRECTORY;

tlck->type = 0;

/* bind the tlock and the page */
Expand Down Expand Up @@ -1009,6 +1012,8 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type)

/* bind the tlock and the object */
tlck->flag = tlckINODELOCK;
if (S_ISDIR(ip->i_mode))
tlck->flag |= tlckDIRECTORY;
tlck->ip = ip;
tlck->mp = NULL;

Expand Down Expand Up @@ -1077,6 +1082,8 @@ struct linelock *txLinelock(struct linelock * tlock)
linelock->flag = tlckLINELOCK;
linelock->maxcnt = TLOCKLONG;
linelock->index = 0;
if (tlck->flag & tlckDIRECTORY)
linelock->flag |= tlckDIRECTORY;

/* append linelock after tlock */
linelock->next = tlock->next;
Expand Down Expand Up @@ -2358,7 +2365,7 @@ static void txUpdateMap(struct tblock * tblk)
*/
else { /* (maplock->flag & mlckFREE) */

if (S_ISDIR(tlck->ip->i_mode))
if (tlck->flag & tlckDIRECTORY)
txFreeMap(ipimap, maplock,
tblk, COMMIT_PWMAP);
else
Expand Down
1 change: 1 addition & 0 deletions fs/jfs/jfs_txnmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ extern struct tlock *TxLock; /* transaction lock table */
#define tlckLOG 0x0800
/* updateMap state */
#define tlckUPDATEMAP 0x0080
#define tlckDIRECTORY 0x0040
/* freeLock state */
#define tlckFREELOCK 0x0008
#define tlckWRITEPAGE 0x0004
Expand Down

0 comments on commit 438282d

Please sign in to comment.