Re: [PATCH] Ensure prepare_update_cmtime() returns an initializedvalue (was: Re: [PATCH v4 2/7] fs: Add inode_update_time_writable)

From: Andy Lutomirski
Date: Wed Sep 04 2013 - 14:30:56 EST


I'll integrate that into v5.

--Andy

On Wed, Sep 4, 2013 at 11:27 AM, Sylvain 'ythier' Hitier
<sylvain.hitier@xxxxxxxxx> wrote:
> Hello,
>
> This is to apply on top of
> "[PATCH v4 2/7] fs: Add inode_update_time_writable"
> dated Thu, 22 Aug 2013 17:03:18 -0700
>
>
>
> Ensure prepare_update_cmtime() returns an initialized value.
>
> While at it:
> - always use sync_it var as a bitfield
> - remove useless test
>
> Signed-off-by: Sylvain "ythier" Hitier <sylvain.hitier@xxxxxxxxx>
> ---
> fs/inode.c | 7 ++-----
> 1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index 2bbcb19..edf225c 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -1643,7 +1643,7 @@ EXPORT_SYMBOL(file_remove_suid);
> */
> static int prepare_update_cmtime(struct inode *inode, struct timespec *now)
> {
> - int sync_it;
> + int sync_it = 0;
>
> /* First try to exhaust all avenues to not sync */
> if (IS_NOCMTIME(inode))
> @@ -1651,7 +1651,7 @@ static int prepare_update_cmtime(struct inode *inode, struct timespec *now)
>
> *now = current_fs_time(inode->i_sb);
> if (!timespec_equal(&inode->i_mtime, now))
> - sync_it = S_MTIME;
> + sync_it |= S_MTIME;
>
> if (!timespec_equal(&inode->i_ctime, now))
> sync_it |= S_CTIME;
> @@ -1659,9 +1659,6 @@ static int prepare_update_cmtime(struct inode *inode, struct timespec *now)
> if (IS_I_VERSION(inode))
> sync_it |= S_VERSION;
>
> - if (!sync_it)
> - return 0;
> -
> return sync_it;
> }
>
>
> Regards,
> Sylvain "ythier" Hitier
>
> --
> Business is about being busy, not being rich...
> Lived 777 days in a Debian package => http://en.wikipedia.org/wiki/Apt,_Vaucluse
> There's THE room for ideals in this mechanical place!



--
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/