aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r--fs/gfs2/ops_file.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 3fb1a29f88a6..c2dbc300a50c 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -545,8 +545,6 @@ static const u32 iflags_to_gfs2[32] = {
545 [iflag_Index] = GFS2_DIF_EXHASH, 545 [iflag_Index] = GFS2_DIF_EXHASH,
546 [iflag_JournalData] = GFS2_DIF_JDATA, 546 [iflag_JournalData] = GFS2_DIF_JDATA,
547 [iflag_DirectIO] = GFS2_DIF_DIRECTIO, 547 [iflag_DirectIO] = GFS2_DIF_DIRECTIO,
548 [iflag_InheritDirectIO] = GFS2_DIF_INHERIT_DIRECTIO,
549 [iflag_InheritJdata] = GFS2_DIF_INHERIT_JDATA,
550}; 548};
551 549
552static const u32 gfs2_to_iflags[32] = { 550static const u32 gfs2_to_iflags[32] = {
@@ -557,8 +555,8 @@ static const u32 gfs2_to_iflags[32] = {
557 [gfs2fl_ExHash] = IFLAG_INDEX, 555 [gfs2fl_ExHash] = IFLAG_INDEX,
558 [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA, 556 [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA,
559 [gfs2fl_Directio] = IFLAG_DIRECTIO, 557 [gfs2fl_Directio] = IFLAG_DIRECTIO,
560 [gfs2fl_InheritDirectio] = IFLAG_INHERITDIRECTIO, 558 [gfs2fl_InheritDirectio] = IFLAG_DIRECTIO,
561 [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA, 559 [gfs2fl_InheritJdata] = IFLAG_JOURNAL_DATA,
562}; 560};
563 561
564static int gfs2_get_flags(struct file *filp, u32 __user *ptr) 562static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
@@ -621,20 +619,17 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
621 if ((new_flags ^ flags) == 0) 619 if ((new_flags ^ flags) == 0)
622 goto out; 620 goto out;
623 621
622 if (S_ISDIR(inode->i_mode)) {
623 if ((new_flags ^ flags) & GFS2_DIF_JDATA)
624 new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA);
625 if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO)
626 new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO);
627 }
628
624 error = -EINVAL; 629 error = -EINVAL;
625 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) 630 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET)
626 goto out; 631 goto out;
627 632
628 if (S_ISDIR(inode->i_mode)) {
629 if ((new_flags ^ flags) & (GFS2_DIF_JDATA | GFS2_DIF_DIRECTIO))
630 goto out;
631 } else if (S_ISREG(inode->i_mode)) {
632 if ((new_flags ^ flags) & (GFS2_DIF_INHERIT_DIRECTIO|
633 GFS2_DIF_INHERIT_JDATA))
634 goto out;
635 } else
636 goto out;
637
638 error = -EPERM; 633 error = -EPERM;
639 if (IS_IMMUTABLE(inode) && (new_flags & GFS2_DIF_IMMUTABLE)) 634 if (IS_IMMUTABLE(inode) && (new_flags & GFS2_DIF_IMMUTABLE))
640 goto out; 635 goto out;