aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_dmap.c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2006-03-08 11:59:15 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-03-08 11:59:15 -0500
commitbe0bf7da19135a7a0f8c275f20c819940be218d9 (patch)
treec8ba72b711730ce11f52fc20cd7c0e9c4bee7bc0 /fs/jfs/jfs_dmap.c
parent5b3030e39049212c975665cdb3eeabcfaf7c94ca (diff)
JFS: Take logsync lock before testing mp->lsn
This fixes a race where lsn could be cleared before taking the lock Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs/jfs/jfs_dmap.c')
-rw-r--r--fs/jfs/jfs_dmap.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 4fb3ed184925..c161c98954e0 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -532,10 +532,10 @@ dbUpdatePMap(struct inode *ipbmap,
532 532
533 lastlblkno = lblkno; 533 lastlblkno = lblkno;
534 534
535 LOGSYNC_LOCK(log, flags);
535 if (mp->lsn != 0) { 536 if (mp->lsn != 0) {
536 /* inherit older/smaller lsn */ 537 /* inherit older/smaller lsn */
537 logdiff(diffp, mp->lsn, log); 538 logdiff(diffp, mp->lsn, log);
538 LOGSYNC_LOCK(log, flags);
539 if (difft < diffp) { 539 if (difft < diffp) {
540 mp->lsn = lsn; 540 mp->lsn = lsn;
541 541
@@ -548,20 +548,17 @@ dbUpdatePMap(struct inode *ipbmap,
548 logdiff(diffp, mp->clsn, log); 548 logdiff(diffp, mp->clsn, log);
549 if (difft > diffp) 549 if (difft > diffp)
550 mp->clsn = tblk->clsn; 550 mp->clsn = tblk->clsn;
551 LOGSYNC_UNLOCK(log, flags);
552 } else { 551 } else {
553 mp->log = log; 552 mp->log = log;
554 mp->lsn = lsn; 553 mp->lsn = lsn;
555 554
556 /* insert bp after tblock in logsync list */ 555 /* insert bp after tblock in logsync list */
557 LOGSYNC_LOCK(log, flags);
558
559 log->count++; 556 log->count++;
560 list_add(&mp->synclist, &tblk->synclist); 557 list_add(&mp->synclist, &tblk->synclist);
561 558
562 mp->clsn = tblk->clsn; 559 mp->clsn = tblk->clsn;
563 LOGSYNC_UNLOCK(log, flags);
564 } 560 }
561 LOGSYNC_UNLOCK(log, flags);
565 } 562 }
566 563
567 /* write the last buffer. */ 564 /* write the last buffer. */