Ryusuke Konishi | 16 Jul 2012 03:05
Picon
Gravatar

[PATCH 0/4] some nilfs2 fixes

Hi Andrew,

Please apply the following patches and send them upstream via the -mm
tree at the next merge window.

This patchset is composed of two comment fixes and two ioctl-related
fixes in which one is for a deadlock issue and another for a potential
timing issue.

Thanks,
Ryusuke Konishi
--

Fernando Luis Vazquez Cao (1):
      NILFS2: remove references to long gone super operations

Ryusuke Konishi (2):
      nilfs2: fix timing issue between rmcp and chcp ioctls
      nilfs2: fix deadlock issue between chcp and thaw ioctls

Vyacheslav Dubeyko (1):
      nilfs2: add omitted comment for ns_mount_state field of the_nilfs structure

 fs/nilfs2/cpfile.c    |   10 +++++++---
 fs/nilfs2/ioctl.c     |    4 ++--
 fs/nilfs2/super.c     |    6 +++---
 fs/nilfs2/the_nilfs.c |    1 +
 fs/nilfs2/the_nilfs.h |    3 +++
 5 files changed, 16 insertions(+), 8 deletions(-)

(Continue reading)

Ryusuke Konishi | 16 Jul 2012 03:05
Picon
Gravatar

[PATCH 1/4] nilfs2: add omitted comment for ns_mount_state field of the_nilfs structure

From: Vyacheslav Dubeyko <slava <at> dubeyko.com>

This patch adds omitted comment for ns_mount_state field of the_nilfs
structure.

Signed-off-by: Vyacheslav Dubeyko <slava <at> dubeyko.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke <at> lab.ntt.co.jp>
---
 fs/nilfs2/the_nilfs.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index 9992b11..ef40a51 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
 <at>  <at>  -52,6 +52,7  <at>  <at>  enum {
  *  <at> ns_sbwtime: previous write time of super block
  *  <at> ns_sbwcount: write count of super block
  *  <at> ns_sbsize: size of valid data in super block
+ *  <at> ns_mount_state: file system state
  *  <at> ns_seg_seq: segment sequence counter
  *  <at> ns_segnum: index number of the latest full segment.
  *  <at> ns_nextnum: index number of the full segment index to be used next
--

-- 
1.7.9.3

Ryusuke Konishi | 16 Jul 2012 03:05
Picon
Gravatar

[PATCH 2/4] NILFS2: remove references to long gone super operations

From: Fernando Luis Vazquez Cao <fernando <at> oss.ntt.co.jp>

->delete_inode(), ->write_super_lockfs(), ->unlockfs() are gone so remove
refereces to them in the NTFS code. Noticed while cleaning up the fsfreeze
mess.

Signed-off-by: Fernando Luis Vazquez Cao <fernando <at> oss.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke <at> lab.ntt.co.jp>
---
 fs/nilfs2/super.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 1099a76..72b62b6 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
 <at>  <at>  -677,7 +677,6  <at>  <at>  static const struct super_operations nilfs_sops = {
 	.destroy_inode  = nilfs_destroy_inode,
 	.dirty_inode    = nilfs_dirty_inode,
 	/* .write_inode    = nilfs_write_inode, */
-	/* .put_inode      = nilfs_put_inode, */
 	/* .drop_inode	  = nilfs_drop_inode, */
 	.evict_inode    = nilfs_evict_inode,
 	.put_super      = nilfs_put_super,
 <at>  <at>  -685,8 +684,6  <at>  <at>  static const struct super_operations nilfs_sops = {
 	.sync_fs        = nilfs_sync_fs,
 	.freeze_fs	= nilfs_freeze,
 	.unfreeze_fs	= nilfs_unfreeze,
-	/* .write_super_lockfs */
-	/* .unlockfs */
(Continue reading)

Ryusuke Konishi | 16 Jul 2012 03:05
Picon
Gravatar

[PATCH 4/4] nilfs2: fix deadlock issue between chcp and thaw ioctls

An fs-thaw ioctl causes deadlock with a chcp or mkcp -s command:

 chcp            D ffff88013870f3d0     0  1325   1324 0x00000004
 ...
 Call Trace:
  [<ffffffffa06cd409>] ? nilfs_transaction_begin+0x11c/0x1a0 [nilfs2]
  [<ffffffff81056011>] ? wake_up_bit+0x20/0x20
  [<ffffffffa06d3e04>] ? copy_from_user+0x18/0x30 [nilfs2]
  [<ffffffffa06d3e99>] ? nilfs_ioctl_change_cpmode+0x7d/0xcf [nilfs2]
  [<ffffffffa06d4cf8>] ? nilfs_ioctl+0x252/0x61a [nilfs2]
  [<ffffffff813b8966>] ? do_page_fault+0x311/0x34c
  [<ffffffff810e1c2f>] ? get_unmapped_area+0x132/0x14e
  [<ffffffff8110e95c>] ? do_vfs_ioctl+0x44b/0x490
  [<ffffffff81049b7f>] ? __set_task_blocked+0x5a/0x61
  [<ffffffff810d63c1>] ? vm_mmap_pgoff+0x76/0x87
  [<ffffffff81049bb6>] ? __set_current_blocked+0x30/0x4a
  [<ffffffff8110e9ec>] ? sys_ioctl+0x4b/0x6f
  [<ffffffff813bbc79>] ? system_call_fastpath+0x16/0x1b
 thaw            D ffff88013870d890     0  1352   1351 0x00000004
 ...
 Call Trace:
  [<ffffffff813b5551>] ? rwsem_down_failed_common+0xdb/0x10f
  [<ffffffff812172c3>] ? call_rwsem_down_write_failed+0x13/0x20
  [<ffffffff813b42f4>] ? down_write+0x25/0x27
  [<ffffffff811032e7>] ? thaw_super+0x13/0x9e
  [<ffffffff8110e706>] ? do_vfs_ioctl+0x1f5/0x490
  [<ffffffff810d63c1>] ? vm_mmap_pgoff+0x76/0x87
  [<ffffffff8110e9ec>] ? sys_ioctl+0x4b/0x6f
  [<ffffffff810ff731>] ? filp_close+0x64/0x6c
  [<ffffffff813bbc79>] ? system_call_fastpath+0x16/0x1b
(Continue reading)

Ryusuke Konishi | 16 Jul 2012 03:05
Picon
Gravatar

[PATCH 3/4] nilfs2: fix timing issue between rmcp and chcp ioctls

The checkpoint deletion ioctl (rmcp ioctl) has potential for breaking
snapshot because it is not fully exclusive with checkpoint mode change
ioctl (chcp ioctl).

The rmcp ioctl first tests if the specified checkpoint is a snapshot
or not within nilfs_cpfile_delete_checkpoint function, and then calls
nilfs_cpfile_delete_checkpoints function to actually invalidate the
checkpoint only if it's not a snapshot.  However, the checkpoint can
be changed into a snapshot by the chcp ioctl between these two
operations.  In that case, calling nilfs_cpfile_delete_checkpoints()
wrongly invalidates the snapshot, which leads to snapshot list
corruption and snapshot count mismatch.

This fixes the issue by changing nilfs_cpfile_delete_checkpoints() so
that it reconfirms the target checkpoints are snapshot or not.

This second check is exclusive with the chcp operation since
it is protected by an existing semaphore.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke <at> lab.ntt.co.jp>
---
 fs/nilfs2/cpfile.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
index dab5c4c..deaa3d3 100644
--- a/fs/nilfs2/cpfile.c
+++ b/fs/nilfs2/cpfile.c
 <at>  <at>  -286,7 +286,7  <at>  <at>  int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
 	__u64 cno;
(Continue reading)


Gmane