From: nikita Date: Sat, 18 Oct 2008 17:09:55 +0000 (+0000) Subject: Use appropriately tagged _nested() locking calls in the places where llog X-Git-Tag: v1_9_90~67 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0ebc3ff4b52ca76586cf8339118f18a5195302fb Use appropriately tagged _nested() locking calls in the places where llog takes more than one ->lgh_lock lock. b=16450 --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 2e86b3b..2c214df 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1575,6 +1575,12 @@ Details : Add new ->l_weigh_ast() call-back to ldlm_lock. It is called by ldlm_cancel_shrink_policy() to estimate lock "value", instead of hard-coded `number of pages' logic. +Severity : normal +Bugzilla : 16450 +Description: Add lockdep annotations to llog code. +Details : Use appropriately tagged _nested() locking calls in the places + where llog takes more than one ->lgh_lock lock. + -------------------------------------------------------------------------------- 2007-08-10 Cluster File Systems, Inc. diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index b32d343..1d2101c1 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -211,7 +211,15 @@ int llog_cat_put(struct llog_handle *cathandle) } EXPORT_SYMBOL(llog_cat_put); -/* Return the currently active log handle. If the current log handle doesn't +/** + * lockdep markers for nested struct llog_handle::lgh_lock locking. + */ +enum { + LLOGH_CAT, + LLOGH_LOG +}; + +/** Return the currently active log handle. If the current log handle doesn't * have enough space left for the current record, start a new one. * * If reclen is 0, we only want to know what the currently active log is, @@ -228,11 +236,11 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, struct llog_handle *loghandle = NULL; ENTRY; - down_read(&cathandle->lgh_lock); + down_read_nested(&cathandle->lgh_lock, LLOGH_CAT); loghandle = cathandle->u.chd.chd_current_log; if (loghandle) { struct llog_log_hdr *llh = loghandle->lgh_hdr; - down_write(&loghandle->lgh_lock); + down_write_nested(&loghandle->lgh_lock, LLOGH_LOG); if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_read(&cathandle->lgh_lock); RETURN(loghandle); @@ -252,11 +260,11 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, /* time to create new log */ /* first, we have to make sure the state hasn't changed */ - down_write(&cathandle->lgh_lock); + down_write_nested(&cathandle->lgh_lock, LLOGH_CAT); loghandle = cathandle->u.chd.chd_current_log; if (loghandle) { struct llog_log_hdr *llh = loghandle->lgh_hdr; - down_write(&loghandle->lgh_lock); + down_write_nested(&loghandle->lgh_lock, LLOGH_LOG); if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) { up_write(&cathandle->lgh_lock); RETURN(loghandle); @@ -269,7 +277,7 @@ static struct llog_handle *llog_cat_current_log(struct llog_handle *cathandle, CDEBUG(D_INODE, "creating new log\n"); loghandle = llog_cat_new_log(cathandle, lid); if (!IS_ERR(loghandle)) - down_write(&loghandle->lgh_lock); + down_write_nested(&loghandle->lgh_lock, LLOGH_LOG); up_write(&cathandle->lgh_lock); RETURN(loghandle); } @@ -321,7 +329,7 @@ int llog_cat_cancel_records(struct llog_handle *cathandle, int count, int i, index, rc = 0; ENTRY; - down_write(&cathandle->lgh_lock); + down_write_nested(&cathandle->lgh_lock, LLOGH_CAT); for (i = 0; i < count; i++, cookies++) { struct llog_handle *loghandle; struct llog_logid *lgl = &cookies->lgc_lgl; @@ -332,7 +340,7 @@ int llog_cat_cancel_records(struct llog_handle *cathandle, int count, break; } - down_write(&loghandle->lgh_lock); + down_write_nested(&loghandle->lgh_lock, LLOGH_LOG); rc = llog_cancel_rec(loghandle, cookies->lgc_index); up_write(&loghandle->lgh_lock); diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index eb07423..47c1e53 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -736,7 +736,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle) rc = llog_lvfs_close(handle); if (rc == 0) { - LOCK_INODE_MUTEX(inode); + LOCK_INODE_MUTEX_PARENT(inode); rc = ll_vfs_unlink(inode, fdentry, mnt); UNLOCK_INODE_MUTEX(inode); }