xfs
[Top] [All Lists]

Re: [PATCH v3 2/5] fs: Add inode_update_time_writable

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH v3 2/5] fs: Add inode_update_time_writable
From: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
Date: Mon, 19 Aug 2013 20:20:12 -0700
Cc: "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "linux-ext4@xxxxxxxxxxxxxxx" <linux-ext4@xxxxxxxxxxxxxxx>, "Theodore Ts'o" <tytso@xxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, Jan Kara <jack@xxxxxxx>, Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130820022822.GD6023@dastard>
References: <cover.1376679411.git.luto@xxxxxxxxxxxxxx> <a27accc2d9460b7ef194a203f305a18dafe926e8.1376679411.git.luto@xxxxxxxxxxxxxx> <20130820022822.GD6023@dastard>
On Mon, Aug 19, 2013 at 7:28 PM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
> On Fri, Aug 16, 2013 at 04:22:09PM -0700, Andy Lutomirski wrote:
>> This is like file_update_time, except that it acts on a struct inode *
>> instead of a struct file *.
>>
>> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
>> ---
>>  fs/inode.c         | 72 
>> ++++++++++++++++++++++++++++++++++++++++++------------
>>  include/linux/fs.h |  1 +
>>  2 files changed, 58 insertions(+), 15 deletions(-)
>>

[...]

>> +
>> +int inode_update_time_writable(struct inode *inode)
>> +{
>> +     struct timespec now;
>> +     int sync_it = prepare_update_cmtime(inode, &now);
>> +     int ret;
>> +
>> +     if (!sync_it)
>> +             return 0;
>> +
>> +     /* sb_start_pagefault and update_time can both sleep. */
>> +     sb_start_pagefault(inode->i_sb);
>> +     ret = update_time(inode, &now, sync_it);
>> +     sb_end_pagefault(inode->i_sb);
>
> This gets called from the writeback path - you can't use
> sb_start_pagefault/sb_end_pagefault in that path.

The race I'm worried about is:

 - mmap
 - write to the mapping
 - remount ro
 - flush_cmtime -> inode_update_time_writable

This may be impossible, in which case I'm okay, but it's nice to have
a sanity check.  I'll see if I can figure out how to do that.

--Andy

<Prev in Thread] Current Thread [Next in Thread>