Whamcloud - gitweb
Branch b1_8_gate
authoryangsheng <yangsheng>
Wed, 23 Jul 2008 06:28:49 +0000 (06:28 +0000)
committeryangsheng <yangsheng>
Wed, 23 Jul 2008 06:28:49 +0000 (06:28 +0000)
b=15593
i=johann, shadow

The do_truncate() also remove the suid/sgid bits since 2.6.22 kernel, This
patch fixed the issue on server side.

lustre/mds/mds_reint.c

index 8ed9e65..4e43a09 100644 (file)
@@ -352,7 +352,15 @@ int mds_fix_attr(struct inode *inode, struct mds_update_record *rec)
                         attr->ia_valid |= ATTR_MODE;
                 }
         } else if (ia_valid & ATTR_MODE) {
-                int mode = attr->ia_mode;
+                int mode;
+                if (!(attr->ia_valid & ATTR_FORCE)) {
+                        mode = inode->i_mode;
+                        if (((mode & S_ISUID) && (!(attr->ia_mode & S_ISUID))) ||
+                            ((mode & S_ISGID) && (mode & S_IXGRP) &&
+                            (!(attr->ia_mode & S_ISGID))))
+                                attr->ia_valid |= ATTR_FORCE;
+                }
+                mode = attr->ia_mode;
                 /* chmod */
                 if (attr->ia_mode == (umode_t)-1)
                         mode = inode->i_mode;