From 34a1046c1ec492005ed5c173658bb54654d7e075 Mon Sep 17 00:00:00 2001
From: yangsheng <yangsheng>
Date: Wed, 23 Jul 2008 06:25:03 +0000
Subject: [PATCH] Branch b1_6 b=15593 i=johann, shadow

The do_truncate() also remove the suid/sgid since 2.6.22 kernel. This
patch fixed issue on server side.
---
 lustre/mds/mds_reint.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c
index 3cd251f67c..5cead34a81 100644
--- a/lustre/mds/mds_reint.c
+++ b/lustre/mds/mds_reint.c
@@ -320,7 +320,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;
-- 
GitLab