takes more than one ->lgh_lock lock.
b=16450
by ldlm_cancel_shrink_policy() to estimate lock "value", instead of
hard-coded `number of pages' logic.
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. <info@clusterfs.com>
--------------------------------------------------------------------------------
2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com>
}
EXPORT_SYMBOL(llog_cat_put);
}
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,
* 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,
struct llog_handle *loghandle = NULL;
ENTRY;
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;
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);
if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
up_read(&cathandle->lgh_lock);
RETURN(loghandle);
/* time to create new log */
/* first, we have to make sure the state hasn't changed */
/* 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;
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);
if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
up_write(&cathandle->lgh_lock);
RETURN(loghandle);
CDEBUG(D_INODE, "creating new log\n");
loghandle = llog_cat_new_log(cathandle, lid);
if (!IS_ERR(loghandle))
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);
}
up_write(&cathandle->lgh_lock);
RETURN(loghandle);
}
int i, index, rc = 0;
ENTRY;
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;
for (i = 0; i < count; i++, cookies++) {
struct llog_handle *loghandle;
struct llog_logid *lgl = &cookies->lgc_lgl;
- 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);
rc = llog_cancel_rec(loghandle, cookies->lgc_index);
up_write(&loghandle->lgh_lock);
rc = llog_lvfs_close(handle);
if (rc == 0) {
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);
}
rc = ll_vfs_unlink(inode, fdentry, mnt);
UNLOCK_INODE_MUTEX(inode);
}