linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] vfs: notify_changes() error handling
@ 2010-02-19 19:47 Dmitry Monakhov
  2010-02-19 19:47 ` [PATCH 1/7] mm: add nofail version of vmtruncate() and inode_setattr() Dmitry Monakhov
  2010-02-22 10:35 ` [PATCH 0/7] vfs: notify_changes() error handling Jan Kara
  0 siblings, 2 replies; 13+ messages in thread
From: Dmitry Monakhov @ 2010-02-19 19:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Dmitry Monakhov

Current inode attr setting path looks like follows

 ret = inode_change_ok()
 if(ret)
     goto out;
 /*
  perform private-fs specific logic here
  */
 if(ia_valid & ATTR_UID || ...)
    ret = vfs_dq_transfer()

 /*
   more private-fs specific logic
   for example update on_disk data structures.
   */

  ret = inode_setattr()

In fact inode_setattr() call vmtruncate() which may fail in number
of reasons IS_SWAPFILE, RLIMIT_FSIZE. After this many filesystem is
unable to rollback changes. And just live inode in inconsistent
state. We may check IS_SWAPFILE at the very beginning(currently it
is not checked), but RLIMIT_FSIZE may changed under our feet.
In order make things straight. Let's divide vmtruncate() in to
two parts which perform all checks, and second which can not fail.
After this notify_change() perform all necessary checks inside
inode_change_ok() and simply call nofail version of vmtruncate().

##TEST_CASE_BEGIN:
# dd if=/dev/zero of=/mnt/file bs=1M count=10
# mkswap /mnt/file
# swapon /mnt/file
# ./truncate /mnt/file 0
# sync
# echo "stat file" | debugfs /dev/sda9
debugfs 1.41.9 (22-Aug-2009)
Inode: 2746   Type: regular    Mode:  0644   Flags: 0x80000
Generation: 571328532    Version: 0x00000000:00000001
User:     0   Group:     0   Size: 0
##### ON_DISK_SIZE IS ZERO ^^^^^^^^^^^^
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 20480
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x4b7ee6cc:d4bbee04 -- Fri Feb 19 22:30:20 2010
 atime: 0x4b7ee6d3:91fb9b9c -- Fri Feb 19 22:30:27 2010
 mtime: 0x4b7ee6cc:d4bbee04 -- Fri Feb 19 22:30:20 2010
crtime: 0x4b7eb3c4:01f8d494 -- Fri Feb 19 18:52:36 2010
dtime: 0x00000aba -- Thu Jan  1 03:45:46 1970
Size of extra inode fields: 28
EXTENTS:
(0-2559): 112640-115199
##TEST_CASE_END

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-02-22 17:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-19 19:47 [PATCH 0/7] vfs: notify_changes() error handling Dmitry Monakhov
2010-02-19 19:47 ` [PATCH 1/7] mm: add nofail version of vmtruncate() and inode_setattr() Dmitry Monakhov
2010-02-19 19:47   ` [PATCH 2/7] vfs: inode_change_ok have to perform all necessery checks Dmitry Monakhov
2010-02-19 19:47     ` [PATCH 3/7] vfs: do not allow inode_setattr() to fail after vfs_dq_transfer() Dmitry Monakhov
2010-02-19 19:47       ` [PATCH 4/7] ext2: use nofail variant of inode_setattr() Dmitry Monakhov
2010-02-19 19:47         ` [PATCH 5/7] ext3: " Dmitry Monakhov
2010-02-19 19:47           ` [PATCH 6/7] ext4: " Dmitry Monakhov
2010-02-19 19:47             ` [PATCH 7/7] ocfs2: " Dmitry Monakhov
2010-02-22 10:35 ` [PATCH 0/7] vfs: notify_changes() error handling Jan Kara
2010-02-22 11:15   ` Nick Piggin
2010-02-22 13:30     ` Dmitry Monakhov
2010-02-22 14:56       ` Nick Piggin
2010-02-22 17:37         ` Dmitry Monakhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).