From 9e1de69f7729392aea24c8bfc22d0220a0eeeedb Mon Sep 17 00:00:00 2001 From: scjody Date: Wed, 21 Mar 2007 20:44:42 +0000 Subject: [PATCH] Branch HEAD Merge the following changes from b1_4: lfs quotachown deletes security relevant setuid bit b=11463 r=Adilger (Committed by tianzy) Land kernel config changes for 2.4 kernels from b_release_1_4_8 to b1_4. (Committed by adilger) b=10736 Add getattr on lookup operation for NFS, so that it can properl revalidate file attributes. (Committed by green) r=adilger r=green r=nathan --- .../kernel-2.4.21-rhel-2.4-i686.config | 2 +- .../kernel-2.4.21-rhel-2.4-ia64.config | 2 +- .../kernel-2.4.21-rhel-2.4-x86_64.config | 2 +- .../nfs_export_kernel-getattr_on_lookup-2.4.patch | 64 ++++++++++++++++++++++ lustre/utils/liblustreapi.c | 10 +++- 5 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 lustre/kernel_patches/patches/nfs_export_kernel-getattr_on_lookup-2.4.patch diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config index 4da2e72..2e0d417 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-i686.config @@ -867,7 +867,7 @@ CONFIG_ACENIC=m CONFIG_DL2K=m CONFIG_E1000=m CONFIG_E1000_NAPI=y -# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set +CONFIG_E1000_DISABLE_PACKET_SPLIT=y # CONFIG_MYRI_SBUS is not set CONFIG_NS83820=m CONFIG_HAMACHI=m diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config index 2e3bad9..ff4b0d1 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-ia64.config @@ -716,7 +716,7 @@ CONFIG_ACENIC=m CONFIG_DL2K=m CONFIG_E1000=m CONFIG_E1000_NAPI=y -# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set +CONFIG_E1000_DISABLE_PACKET_SPLIT=y # CONFIG_MYRI_SBUS is not set CONFIG_NS83820=m CONFIG_HAMACHI=m diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config index c755460..0d9818a 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config @@ -777,7 +777,7 @@ CONFIG_ACENIC=m CONFIG_DL2K=m CONFIG_E1000=m CONFIG_E1000_NAPI=y -# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set +CONFIG_E1000_DISABLE_PACKET_SPLIT=y # CONFIG_MYRI_SBUS is not set CONFIG_NS83820=m CONFIG_HAMACHI=m diff --git a/lustre/kernel_patches/patches/nfs_export_kernel-getattr_on_lookup-2.4.patch b/lustre/kernel_patches/patches/nfs_export_kernel-getattr_on_lookup-2.4.patch new file mode 100644 index 0000000..2becbc4 --- /dev/null +++ b/lustre/kernel_patches/patches/nfs_export_kernel-getattr_on_lookup-2.4.patch @@ -0,0 +1,64 @@ +--- linux-2.4.24orig/include/linux/fs.h.orig 2006-07-21 13:03:15.000000000 +0300 ++++ linux-2.4.24/include/linux/fs.h 2006-07-21 13:03:46.000000000 +0300 +@@ -1128,6 +1128,8 @@ extern int open_namei_it(const char *fil + extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt, + int flags, struct lookup_intent *it); + extern int revalidate_it(struct dentry *dentry, struct lookup_intent *it); ++struct dentry * lookup_one_len_getattr(const char * name, struct dentry * base, ++ int len); + extern int init_private_file_it(struct file *, struct dentry *dentry, int mode, + struct lookup_intent *it); + extern int filp_close(struct file *, fl_owner_t id); +--- linux-2.4.24orig/fs/nfsd/vfs.c.orig 2006-07-21 12:52:07.000000000 +0300 ++++ linux-2.4.24/fs/nfsd/vfs.c 2006-07-21 13:28:15.000000000 +0300 +@@ -198,6 +198,30 @@ int revalidate_it(struct dentry *dentry, + return err; + } + ++struct dentry * lookup_one_len_getattr(const char * name, struct dentry * base, ++ int len) ++{ ++ struct lookup_intent it; ++ struct dentry *de; ++ ++ intent_init(&it, IT_GETATTR, 0); ++ ++ de = lookup_one_len_it(name, base, len, NULL); ++ ++ if (!IS_ERR(de) && de->d_inode) { ++ if (de->d_inode->i_op && de->d_inode->i_op->revalidate_it) ++ de->d_inode->i_op->revalidate_it(de, &it); ++ else if (de->d_inode->i_op && de->d_inode->i_op->revalidate) ++ de->d_inode->i_op->revalidate(de); ++ } ++ ++ if (it.it_op_release) ++ intent_release(&it); ++ ++ return de; ++} ++ ++ + /* + * Look up one component of a pathname. + * N.B. After this call _both_ fhp and resfh need an fh_put +@@ -263,7 +287,7 @@ nfsd_lookup(struct svc_rqst *rqstp, stru + } + } else { + fh_lock(fhp); +- dentry = lookup_one_len(name, dparent, len); ++ dentry = lookup_one_len_getattr(name, dparent, len); + err = PTR_ERR(dentry); + if (IS_ERR(dentry)) + goto out_nfserr; +--- linux-2.4.24orig/fs/nfsd/nfs3xdr.c.orig 2006-07-21 13:02:18.000000000 +0300 ++++ linux-2.4.24/fs/nfsd/nfs3xdr.c 2006-07-21 13:02:29.000000000 +0300 +@@ -715,7 +715,7 @@ encode_entry(struct readdir_cd *cd, cons + dchild = dchild->d_parent; + dchild = dget(dchild); + } else +- dchild = lookup_one_len(name, dparent,namlen); ++ dchild = lookup_one_len_getattr(name, dparent,namlen); + if (IS_ERR(dchild)) + goto noexec; + if (fh_compose(&fh, exp, dchild, cd->dirfh) != 0 || !dchild->d_inode) diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index ada17be..49e751f 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1245,10 +1245,14 @@ static int cb_quotachown(char *path, DIR *parent, DIR *d, void *data) /* libc chown() will do extra check, and if the real owner is * the same as the ones to set, it won't fall into kernel, so * invoke syscall directly. */ - rc = syscall(SYS_chown, path, st->st_uid, st->st_gid); + rc = syscall(SYS_chown, path, -1, -1); if (rc) - err_msg("error: chown %s (%u,%u)", - path, st->st_uid, st->st_gid); + err_msg("error: chown %s (%u,%u)", path); + + rc = chmod(path, st->st_mode); + if (rc) + err_msg("error: chmod %s (%hu)", path, st->st_mode); + return rc; } -- 1.8.3.1