Whamcloud - gitweb
LU-857 security: Lustre client tolerates enforced SELinux.
authorAurelien Degremont <aurelien.degremont@cea.fr>
Mon, 14 Nov 2011 15:25:57 +0000 (16:25 +0100)
committerOleg Drokin <green@whamcloud.com>
Mon, 21 Nov 2011 05:51:10 +0000 (00:51 -0500)
Fix a bug which prevents Lustre clients to access directoriess when
SELinux is enforced, on RHEL 6.
This patch does not add a real SELinux support for Lustre but ables
to activate it for all other local filesystems, without Lustre
misbehaving.

Signed-off-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Change-Id: Ia6692c96a8439eb9239cb55ce32a1c54958241d1
Reviewed-on: http://review.whamcloud.com/1703
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/namei.c

index dbf6ee0..e5393a1 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/quotaops.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 #include <linux/quotaops.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
+#include <linux/security.h>
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
@@ -331,6 +332,9 @@ static void ll_d_add(struct dentry *de, struct inode *inode)
         if (inode)
                 list_add(&de->d_alias, &inode->i_dentry);
         de->d_inode = inode;
         if (inode)
                 list_add(&de->d_alias, &inode->i_dentry);
         de->d_inode = inode;
+        /* d_instantiate() replacement code should initialize security
+         * context. */
+        security_d_instantiate(de, inode);
 
         /* d_rehash */
         if (!d_unhashed(de)) {
 
         /* d_rehash */
         if (!d_unhashed(de)) {