From d0912bb3a0bf5a14002fb96047c3ea4ce1bfbc0e Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Mon, 7 Mar 2011 17:55:23 +0100 Subject: [PATCH] LU-114 use ll_lookup_one_len() instead of lookup_one_len() in sptlrpc_target_local_copy_conf() should lock the parent dir when doing lookup Recent kernels print a warning when lookup_one_len() is called w/o the parent dir locked. sptlrpc_target_local_copy_conf() should not call lookup_one_len() directly, but ll_lookup_one_len() instead which locks the parent dir for you and also checks for bad inode. Change-Id: I4d020c55382238bbbc6df6017f54b5b585f53c48 Signed-off-by: Johann Lombardi Reviewed-on: http://review.whamcloud.com/303 Tested-by: Hudson Reviewed-by: Oleg Drokin --- lustre/obdfilter/filter.c | 3 ++- lustre/ptlrpc/sec_config.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 0acb373..18a247b 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1482,7 +1482,8 @@ struct dentry *filter_fid2dentry(struct obd_device *obd, } CDEBUG(D_INODE, "looking up object O/%.*s/%s\n", dparent->d_name.len, dparent->d_name.name, name); - dchild = /*ll_*/lookup_one_len(name, dparent, len); + /* dparent is already locked here, so we cannot use ll_lookup_one_len() */ + dchild = lookup_one_len(name, dparent, len); if (dir_dentry == NULL) filter_parent_unlock(dparent); if (IS_ERR(dchild)) { diff --git a/lustre/ptlrpc/sec_config.c b/lustre/ptlrpc/sec_config.c index a8b9630..5af3690 100644 --- a/lustre/ptlrpc/sec_config.c +++ b/lustre/ptlrpc/sec_config.c @@ -1031,8 +1031,8 @@ int sptlrpc_target_local_copy_conf(struct obd_device *obd, push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - dentry = lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs), - strlen(MOUNT_CONFIGS_DIR)); + dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs), + strlen(MOUNT_CONFIGS_DIR)); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot lookup %s directory: rc = %d\n", -- 1.8.3.1