aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2007-07-18 06:40:06 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-08-14 05:34:11 -0400
commitb9af7ca6d37d541fb0ed96355fd5c65501cbbda8 (patch)
treed343aefac556709cc543aafa961496175d138892 /fs/gfs2
parenta867bb28c1cb49ae86d034d8bd8fe6dbcbb19566 (diff)
[GFS2] Fix setting of inherit jdata attr
Due to a mix up between the jdata attribute and inherit jdata attribute it has not been possible to set the inherit jdata attribute on directories. This is now fixed and the ioctl will report the inherit jdata attribute for directories rather than the jdata attribute as it did previously. This stems from our need to have the one bit in the ioctl attr flags mean two different things according to whether the underlying inode is a directory or not. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/ops_file.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 773421130116..94d76ace0b95 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -177,8 +177,8 @@ static const u32 fsflags_to_gfs2[32] = {
177 [5] = GFS2_DIF_APPENDONLY, 177 [5] = GFS2_DIF_APPENDONLY,
178 [7] = GFS2_DIF_NOATIME, 178 [7] = GFS2_DIF_NOATIME,
179 [12] = GFS2_DIF_EXHASH, 179 [12] = GFS2_DIF_EXHASH,
180 [14] = GFS2_DIF_JDATA, 180 [14] = GFS2_DIF_INHERIT_JDATA,
181 [20] = GFS2_DIF_DIRECTIO, 181 [20] = GFS2_DIF_INHERIT_DIRECTIO,
182}; 182};
183 183
184static const u32 gfs2_to_fsflags[32] = { 184static const u32 gfs2_to_fsflags[32] = {
@@ -187,8 +187,6 @@ static const u32 gfs2_to_fsflags[32] = {
187 [gfs2fl_AppendOnly] = FS_APPEND_FL, 187 [gfs2fl_AppendOnly] = FS_APPEND_FL,
188 [gfs2fl_NoAtime] = FS_NOATIME_FL, 188 [gfs2fl_NoAtime] = FS_NOATIME_FL,
189 [gfs2fl_ExHash] = FS_INDEX_FL, 189 [gfs2fl_ExHash] = FS_INDEX_FL,
190 [gfs2fl_Jdata] = FS_JOURNAL_DATA_FL,
191 [gfs2fl_Directio] = FS_DIRECTIO_FL,
192 [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL, 190 [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL,
193 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, 191 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
194}; 192};
@@ -207,6 +205,12 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
207 return error; 205 return error;
208 206
209 fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags); 207 fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags);
208 if (!S_ISDIR(inode->i_mode)) {
209 if (ip->i_di.di_flags & GFS2_DIF_JDATA)
210 fsflags |= FS_JOURNAL_DATA_FL;
211 if (ip->i_di.di_flags & GFS2_DIF_DIRECTIO)
212 fsflags |= FS_DIRECTIO_FL;
213 }
210 if (put_user(fsflags, ptr)) 214 if (put_user(fsflags, ptr))
211 error = -EFAULT; 215 error = -EFAULT;
212 216
@@ -270,13 +274,6 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
270 if ((new_flags ^ flags) == 0) 274 if ((new_flags ^ flags) == 0)
271 goto out; 275 goto out;
272 276
273 if (S_ISDIR(inode->i_mode)) {
274 if ((new_flags ^ flags) & GFS2_DIF_JDATA)
275 new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA);
276 if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO)
277 new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO);
278 }
279
280 error = -EINVAL; 277 error = -EINVAL;
281 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET) 278 if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET)
282 goto out; 279 goto out;
@@ -315,11 +312,19 @@ out:
315 312
316static int gfs2_set_flags(struct file *filp, u32 __user *ptr) 313static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
317{ 314{
315 struct inode *inode = filp->f_path.dentry->d_inode;
318 u32 fsflags, gfsflags; 316 u32 fsflags, gfsflags;
319 if (get_user(fsflags, ptr)) 317 if (get_user(fsflags, ptr))
320 return -EFAULT; 318 return -EFAULT;
321 gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); 319 gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags);
322 return do_gfs2_set_flags(filp, gfsflags, ~0); 320 if (!S_ISDIR(inode->i_mode)) {
321 if (gfsflags & GFS2_DIF_INHERIT_JDATA)
322 gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA);
323 if (gfsflags & GFS2_DIF_INHERIT_DIRECTIO)
324 gfsflags ^= (GFS2_DIF_DIRECTIO | GFS2_DIF_INHERIT_DIRECTIO);
325 return do_gfs2_set_flags(filp, gfsflags, ~0);
326 }
327 return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
323} 328}
324 329
325static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 330static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)