From: adilger Date: Fri, 27 Sep 2002 21:11:53 +0000 (+0000) Subject: Mask off the type bits and not the permission bits. X-Git-Tag: v1_7_100~4659 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=292c6455830e5be84186829f2234b37b21f5e600;p=fs%2Flustre-release.git Mask off the type bits and not the permission bits. --- diff --git a/lustre/lib/simple.c b/lustre/lib/simple.c index 9477aaa..56c819b 100644 --- a/lustre/lib/simple.c +++ b/lustre/lib/simple.c @@ -95,19 +95,20 @@ struct dentry *simple_mknod(struct dentry *dir, char *name, int mode) ASSERT_KERNEL_CTXT("kernel doing mknod outside kernel context\n"); CDEBUG(D_INODE, "creating file %*s\n", (int)strlen(name), name); + down(&dir->d_inode->i_sem); dchild = lookup_one_len(name, dir, strlen(name)); if (IS_ERR(dchild)) GOTO(out, PTR_ERR(dchild)); if (dchild->d_inode) { - if (((dchild->d_inode->i_mode ^ mode) & S_IFMT) != 0) + if ((dchild->d_inode->i_mode & S_IFMT) != S_IFREG) GOTO(out, err = -EEXIST); GOTO(out, dchild); } - err = vfs_create(dir->d_inode, dchild, (mode & S_IFMT) | S_IFREG); + err = vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG); EXIT; out: up(&dir->d_inode->i_sem);