From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [PATCH v3 2/5] fs: Add inode_update_time_writable Date: Tue, 20 Aug 2013 13:33:29 +1000 Message-ID: <20130820033329.GG6023@dastard> References: <20130820022822.GD6023@dastard> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Jan Kara , Dave Hansen , "linux-kernel@vger.kernel.org" , xfs@oss.sgi.com, Christoph Hellwig , Theodore Ts'o , "linux-ext4@vger.kernel.org" , Tim Chen To: Andy Lutomirski Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com List-Id: linux-ext4.vger.kernel.org On Mon, Aug 19, 2013 at 08:20:12PM -0700, Andy Lutomirski wrote: > On Mon, Aug 19, 2013 at 7:28 PM, Dave Chinner 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 > >> --- > >> 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 sb_start_pagefault() is for filesystem freeze protection, not remount-ro protection. If you freeze the filesystem, then we stop writes and pagefaults by making sb_start_pagefault/sb_start_write block, and then run writeback to clean all the pages. If writeback then blocks on sb_start_pagefault(), we've got a deadlock. > 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. The process of remount-ro should flush the dirty pages - the inode and page has been marked dirty by page_mkwrite(), after all. Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs