From 705e2099473453b52983b8d4e8d9516cdee3fff7 Mon Sep 17 00:00:00 2001 From: vitaly Date: Thu, 16 Nov 2006 10:54:39 +0000 Subject: [PATCH] Branch b_new_cmd b=11103 Do not let dentry to be unhashed after create, some callers, e.g. do_coredump, expect it to be hashed. --- lustre/llite/namei.c | 7 ++++++- lustre/tests/sanity.sh | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index ac34532..6f4ef70 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -679,7 +679,12 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode, RETURN(PTR_ERR(inode)); } - d_instantiate(dentry, inode); + /* Negative dentry may be unhashed if parent does not have UPDATE lock, + * but some callers, e.g. do_coredump, expect dentry to be hashed after + * successful create. Hash it here. */ + spin_lock(&dcache_lock); + ll_d_add(dentry, inode); + spin_unlock(&dcache_lock); RETURN(0); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f1edf2d..57183a4 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3254,6 +3254,31 @@ test_104() { } run_test 104 "lfs df [-ih] [path] test =========================" +test_107() { + CDIR=`pwd` + cd $DIR + ulimit -c unlimited + sleep 60 & + MULTIPID=$! + + file=`cat /proc/sys/kernel/core_pattern` + core_pid=`cat /proc/sys/kernel/core_uses_pid` + [ $core_pid -eq 1 ] && file=$file.$MULTIPID + rm -f $file + sleep 1 + + kill -s 11 $MULTIPID + wait $MULTIPID + if [ -e $file ]; then + size=`stat -c%s $file` + [ $size -eq 0 ] && error "Fail to create core file" + else + error "Fail to create core file" + fi + cd $CDIR +} +run_test 107 "Coredump on SIG" + TMPDIR=$OLDTMPDIR TMP=$OLDTMP HOME=$OLDHOME -- 1.8.3.1