Reiserfs flags question
Hi everyone,
I was looking at fs/reiserfs/inode.c, and I noticed that the functions sd_attrs_to_i_attrs and i_attrs_to_sd_attrs are not exact inverses: i_attrs_to_sd_attrs doesn't convert the S_APPEND flag to REISERFS_APPEND_FL, but sd_attrs_to_i_attrs does convert REISERFS_APPEND_FL to S_APPEND. I was wondering, is this intentional?
--Bart
Hello!
Bart Samwel <[email protected]> wrote:
BS> I was looking at fs/reiserfs/inode.c, and I noticed that the functions BS> sd_attrs_to_i_attrs and i_attrs_to_sd_attrs are not exact inverses:
BS> i_attrs_to_sd_attrs doesn't convert the S_APPEND flag to BS> REISERFS_APPEND_FL, but sd_attrs_to_i_attrs does convert BS> REISERFS_APPEND_FL to S_APPEND. I was wondering, is this intentional?
Indeed this is a mistake.
Everything was still working as expected because i_attrs_to_sd_attrs cannot change anything these days, since the only way to change inode attributes is through special ioctl, that directly assigns passed flags value to i_attrs field of reiserfs specific part of inode.
For the sakr of correctness and also in case there would be another path to change file attrubutes besides the ioctl, this patch below is needed for both 2.4 and 2.6
Thank you very much.
Bye,
Oleg
===== fs/reiserfs/inode.c 1.87 vs edited =====
fs/reiserfs/inode.c +5 -0
@@ -2317,6 +2317,11 @@ *sd_attrs |=REISERFS_IMMUTABLE_FL ; else *sd_attrs &= ~REISERFS_IMMUTABLE_FL ; +if ( inode -> i_flags &S_APPEND ) + *sd_attrs |=REISERFS_APPEND_FL ; +else + *sd_attrs &= ~REISERFS_APPEND_FL ; +if ( inode -> i_flags &S_SYNC ) *sd_attrs |=REISERFS_SYNC_FL ;else