From: "Anton Salikhmetov" <salikhmetov@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-mm@kvack.org, jakob@unthought.net,
linux-kernel@vger.kernel.org, valdis.kletnieks@vt.edu,
riel@redhat.com, ksm@42.dk, staubach@redhat.com,
jesper.juhl@gmail.com, torvalds@linux-foundation.org,
a.p.zijlstra@chello.nl, akpm@linux-foundation.org,
protasnb@gmail.com
Subject: Re: [PATCH 2/2] updating ctime and mtime at syncing
Date: Mon, 14 Jan 2008 21:59:51 +0300 [thread overview]
Message-ID: <4df4ef0c0801141059t6fbdc7dexa8e9abf9d2c94c42@mail.gmail.com> (raw)
In-Reply-To: <E1JEP9P-0007RD-PP@pomaz-ex.szeredi.hu>
2008/1/14, Miklos Szeredi <miklos@szeredi.hu>:
> > 2008/1/14, Miklos Szeredi <miklos@szeredi.hu>:
> > > > http://bugzilla.kernel.org/show_bug.cgi?id=2645
> > > >
> > > > Changes for updating the ctime and mtime fields for memory-mapped files:
> > > >
> > > > 1) new flag triggering update of the inode data;
> > > > 2) new function to update ctime and mtime for block device files;
> > > > 3) new helper function to update ctime and mtime when needed;
> > > > 4) updating time stamps for mapped files in sys_msync() and do_fsync();
> > > > 5) implementing the feature of auto-updating ctime and mtime.
> > >
> > > How exactly is this done?
> > >
> > > Is this catering for this case:
> > >
> > > 1 page is dirtied through mapping
> > > 2 app calls msync(MS_ASYNC)
> > > 3 page is written again through mapping
> > > 4 app calls msync(MS_ASYNC)
> > > 5 ...
> > > 6 page is written back
> > >
> > > What happens at 4? Do we care about this one at all?
> >
> > The POSIX standard requires updating the file times every time when msync()
> > is called with MS_ASYNC. I.e. the time stamps should be updated even
> > when no physical synchronization is being done immediately.
>
> Yes. However, on linux MS_ASYNC is basically a no-op, and without
> doing _something_ with the dirty pages (which afaics your patch
> doesn't do), it's impossible to observe later writes to the same page.
>
> I don't advocate full POSIX conformance anymore, because it's probably
> too expensive to do (I've tried). Rather than that, we should
> probably find some sane compromise, that just fixes the real life
> issue. Here's a pointer to the thread about this:
>
> http://lkml.org/lkml/2007/3/27/55
>
> Your patch may be a good soultion, but you should describe in detail
> what it does when pages are dirtied, and when msync/fsync are called,
> and what happens with multiple msync calls that I've asked about.
>
> I suspect your patch is ignoring writes after the first msync, but
> then why care about msync at all? What's so special about the _first_
> msync? Is it just that most test programs only check this, and not
> what happens if msync is called more than once? That would be a bug
> in the test cases.
>
> > > > +/*
> > > > + * Update the ctime and mtime stamps for memory-mapped block device files.
> > > > + */
> > > > +static void bd_inode_update_time(struct inode *inode)
> > > > +{
> > > > + struct block_device *bdev = inode->i_bdev;
> > > > + struct list_head *p;
> > > > +
> > > > + if (bdev == NULL)
> > > > + return;
> > > > +
> > > > + mutex_lock(&bdev->bd_mutex);
> > > > + list_for_each(p, &bdev->bd_inodes) {
> > > > + inode = list_entry(p, struct inode, i_devices);
> > > > + inode_update_time(inode);
> > > > + }
> > > > + mutex_unlock(&bdev->bd_mutex);
> > > > +}
> > >
> > > Umm, why not just call with file->f_dentry->d_inode, so that you don't
> > > need to do this ugly search for the physical inode? The file pointer
> > > is available in both msync and fsync.
> >
> > I'm not sure if I undestood your question. I see two possible
> > interpretations for this question, and I'm answering both.
> >
> > The intention was to make the data changes in the block device data
> > visible to all device files associated with the block device. Hence
> > the search, because the time stamps for all such device files should
> > be updated as well.
>
> Ahh, but it will only update "active" devices, which are currently
> open, no? Is that what we want?
>
> > Not only the sys_msync() and do_fsync() routines call the helper
> > function mapping_update_time().
>
> Ah yes, __sync_single_inode() calls it as well. Why?
The __sync_single_inode() function calls mapping_update_time()
to enable the "auto-updating" feature discussed earlier.
>
> Miklos
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-01-14 18:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-13 4:39 [PATCH 0/2] yet another attempt to fix the ctime and mtime issue Anton Salikhmetov
2008-01-13 4:39 ` [PATCH 1/2] massive code cleanup of sys_msync() Anton Salikhmetov
2008-01-13 4:46 ` Rik van Riel
2008-01-14 10:49 ` Miklos Szeredi
2008-01-14 11:56 ` Anton Salikhmetov
2008-01-13 4:39 ` [PATCH 2/2] updating ctime and mtime at syncing Anton Salikhmetov
2008-01-13 4:59 ` Rik van Riel
2008-01-14 11:08 ` Miklos Szeredi
2008-01-14 11:15 ` Miklos Szeredi
2008-01-14 12:25 ` Anton Salikhmetov
2008-01-14 12:22 ` Anton Salikhmetov
2008-01-14 13:14 ` Miklos Szeredi
2008-01-14 13:35 ` Peter Zijlstra
2008-01-14 13:39 ` Peter Zijlstra
2008-01-14 13:45 ` Miklos Szeredi
2008-01-14 13:47 ` Miklos Szeredi
2008-01-14 14:17 ` Anton Salikhmetov
2008-01-15 9:53 ` Miklos Szeredi
2008-01-15 10:46 ` Anton Salikhmetov
2008-01-14 18:59 ` Anton Salikhmetov [this message]
2008-01-15 16:02 [PATCH 0/2] Updating ctime and mtime for memory-mapped files [try #4] Anton Salikhmetov
2008-01-15 16:02 ` [PATCH 2/2] Updating ctime and mtime at syncing Anton Salikhmetov
[not found] ` <1200414911.26045.32.camel@twins>
2008-01-15 17:18 ` Anton Salikhmetov
2008-01-15 19:30 ` Peter Zijlstra
2008-01-15 18:04 ` Christoph Hellwig
2008-01-15 19:04 ` Anton Salikhmetov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4df4ef0c0801141059t6fbdc7dexa8e9abf9d2c94c42@mail.gmail.com \
--to=salikhmetov@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=jakob@unthought.net \
--cc=jesper.juhl@gmail.com \
--cc=ksm@42.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=miklos@szeredi.hu \
--cc=protasnb@gmail.com \
--cc=riel@redhat.com \
--cc=staubach@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=valdis.kletnieks@vt.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox