Whamcloud - gitweb
LU-190 opencreate without mode can crash llite
authorLiang Zhen <liang@whamcloud.com>
Mon, 4 Apr 2011 13:46:23 +0000 (21:46 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 18 Apr 2011 19:38:36 +0000 (12:38 -0700)
user should specify mode for opencreate but if they don't llite will
LBUG, which is not good.

Change-Id: I614e655a8bef8ea9d62161591c99d305ce760732
Signed-off-by: Liang Zhen <liang@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/395
Tested-by: Hudson
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/llite/namei.c

index 1f39a7a..f9f9bc7 100644 (file)
@@ -610,7 +610,7 @@ struct lookup_intent *ll_convert_intent(struct open_intent *oit,
                 it->it_op = IT_OPEN;
                 if (lookup_flags & LOOKUP_CREATE)
                         it->it_op |= IT_CREAT;
                 it->it_op = IT_OPEN;
                 if (lookup_flags & LOOKUP_CREATE)
                         it->it_op |= IT_CREAT;
-                it->it_create_mode = oit->create_mode;
+                it->it_create_mode = (oit->create_mode & S_IALLUGO) | S_IFREG;
                 it->it_flags = oit->flags;
         } else {
                 it->it_op = IT_GETATTR;
                 it->it_flags = oit->flags;
         } else {
                 it->it_op = IT_GETATTR;