From: "J. Bruce Fields" <bfields@xxxxxxxxxx> Add some explanation of the DCACHE_DISCONNECTED use here. And hide away the boring warning code in a helper function. Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx> --- fs/ocfs2/dcache.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) By the way, something like this might save me a little time next time I run across this and forget this conversation. But, no big deal if you think it's overkill. Untested except by a make fs/ocfs2/dcache.o. diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index 8db4b58..27677ab 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -446,26 +446,36 @@ void ocfs2_dentry_lock_put(struct ocfs2_super *osb, ocfs2_drop_dentry_lock(osb, dl); } +static void ocfs2_warn_if_missing_lock(struct dentry *dentry, struct inode *inode) +{ + unsigned long long ino = 0ULL; + + /* It's OK not to have the dentry lock on an unhashed dentry: */ + if (d_unhashed(dentry)) + return; + /* + * It's also fine if we're disconnected. (Note: a dentry may be + * marked DCACHE_DISCONNECTED for a brief time after it's been + * fully connected, so we may fail to warn in some cases we + * should. We prefer that to warning when we shouldn't.) + */ + if (dentry->d_flags & DCACHE_DISCONNECTED) + return; + + if (inode) + ino = (unsigned long long)OCFS2_I(inode)->ip_blkno; + mlog(ML_ERROR, "Dentry is missing cluster lock. " + "inode: %llu, d_flags: 0x%x, d_name: %.*s\n", + ino, dentry->d_flags, dentry->d_name.len, + dentry->d_name.name); +} + static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode) { struct ocfs2_dentry_lock *dl = dentry->d_fsdata; if (!dl) { - /* - * No dentry lock is ok if we're disconnected or - * unhashed. - */ - if (!(dentry->d_flags & DCACHE_DISCONNECTED) && - !d_unhashed(dentry)) { - unsigned long long ino = 0ULL; - if (inode) - ino = (unsigned long long)OCFS2_I(inode)->ip_blkno; - mlog(ML_ERROR, "Dentry is missing cluster lock. " - "inode: %llu, d_flags: 0x%x, d_name: %.*s\n", - ino, dentry->d_flags, dentry->d_name.len, - dentry->d_name.name); - } - + ocfs2_warn_if_missing_lock(dentry, inode); goto out; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html