diff options
| author | Andrew Morton <akpm@osdl.org> | 2003-07-10 10:02:02 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-10 10:02:02 -0700 |
| commit | eafe591605deb294a315026372ff1fe6fc572eea (patch) | |
| tree | f8c48e1e286d05281d52cfaffeef481dc174403e /ipc | |
| parent | e9b94f6af1eca7294fdea13b3a289993852b6397 (diff) | |
[PATCH] i_size atomic access
From: Daniel McNeil <daniel@osdl.org>
This adds i_seqcount to the inode structure and then uses i_size_read() and
i_size_write() to provide atomic access to i_size. This is a port of
Andrea Arcangeli's i_size atomic access patch from 2.4. This only uses the
generic reader/writer consistent mechanism.
Before:
mnm:/usr/src/25> size vmlinux
text data bss dec hex filename
2229582 1027683 162436 3419701 342e35 vmlinux
After:
mnm:/usr/src/25> size vmlinux
text data bss dec hex filename
2225642 1027655 162436 3415733 341eb5 vmlinux
3.9k more text, a lot of it fastpath :(
It's a very minor bug, and the fix has a fairly non-minor cost. The most
compelling reason for fixing this is that writepage() checks i_size. If it
sees a transient value it may decide that page is outside i_size and will
refuse to write it. Lost user data.
Diffstat (limited to 'ipc')
| -rw-r--r-- | ipc/shm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ipc/shm.c b/ipc/shm.c index 251c822993d9..ff26adee978e 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -703,7 +703,7 @@ long sys_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr) } file = shp->shm_file; - size = file->f_dentry->d_inode->i_size; + size = i_size_read(file->f_dentry->d_inode); shp->shm_nattch++; shm_unlock(shp); |
