diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-09-20 21:58:11 +0200 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2005-09-20 21:58:11 +0200 |
commit | 438282d85de2c8f8c5183fdf55140e51a0b18670 (patch) | |
tree | ee90f834ebbf60d45b11d48c4a3fac82a1b62752 /fs/jfs/jfs_txnmgr.c | |
parent | JFS: Fix sparse warnings, including endian error (diff) | |
download | linux-438282d85de2c8f8c5183fdf55140e51a0b18670.tar.xz linux-438282d85de2c8f8c5183fdf55140e51a0b18670.zip |
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/jfs/jfs_txnmgr.c')
-rw-r--r-- | fs/jfs/jfs_txnmgr.c | 9 |
1 files changed, 8 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, else tlck->flag = tlckINODELOCK; + if (S_ISDIR(ip->i_mode)) + tlck->flag |= tlckDIRECTORY; + tlck->type = 0; /* bind the tlock and the page */ @@ -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; @@ -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; @@ -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 |