On 06/01/2010 06:47 PM, Christoph Hellwig wrote: > On Tue, Jun 01, 2010 at 06:40:46PM +0300, Boaz Harrosh wrote: >>>> + struct writeback_control wbc = { >>>> + .sync_mode = WB_SYNC_ALL, >>>> + .nr_to_write = LONG_MAX, >>> >>> By setting a nr_to_write you still write out data (at least in theory). >>> >> >> So when do I also sync the data? is that done for me at the VFS layer? > > You never have to. vfs_fsync_range does the data writeout for you. > >>> I'd recommend just copying the code from generic_file_fsync.. >>> >> >> I was actually mimicking the code from nfs/write.c which has similar >> semantics as mine. > > nfs code has no good reason to do that, at least when called from > ->fsync. > >> And if so then I'll need to not reuse the above in .flush > > I would recommend keeping the ->flush code separate. OK, ... I think I got it this time. (I hope) And you are totally right. The ->flush code is called without any locks and the ->fsync is called with i_mutex held. So the previous code was totally racy for ->flush. Boaz -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html