]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Prevent syncing frozen file system
authorTariq Saeed <tariq.x.saeed@oracle.com>
Tue, 8 Dec 2015 23:14:38 +0000 (15:14 -0800)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Wed, 9 Dec 2015 17:30:38 +0000 (09:30 -0800)
commit984abe89bdae5a3c9bc8a7c7741c9173998ca053
tree4dd03a96ccfc3e7638dea87f728cfaadd5d0102d
parent7923c5f12cd0b4cd0cb966bb2a918ec2f96eb59a
Prevent syncing frozen file system

Orabug: 22332381

port from RH. https://lkml.org/lkml/2015/7/9/724
 fs] vfs: Prevent syncing frozen file system (Lukas Czerner)
      [1243404 1241791]
port from RH. https://lkml.org/lkml/2015/7/9/487

From Lukas Czerner <>
Subject [RFC][PATCH] fs: Prevent syncing frozen file system
Date Thu, 9 Jul 2015 19:45:45 +0200

Currently we can end up in a deadlock because of broken
sb_start_write -> s_umount ordering.

The race goes like this:

 - write the file
 - unlink the file - final_iput will not be calles as file is opened
 - freeze the file system
 - Now simultaneously close the file and call sync (or syncfs on that
   particular file system). Sync will get to wait_sb_inodes() where it will
   grab the referece to the inode (__iget()) and later to call iput().
   If we manage to close the file and drop the reference in between those
   calls sync will attempt to do a iput_final() because the inode is now
   unlinked and we're holding the last reference to it. This will
   however block on a frozen file system (ext4_delete_inode for
   example).

Note that I've not been able to reproduce the issue, I've only seen this
happen once. However with some instrumentation (like msleep() in the
wait_sb_inodes() it can be achieved.

Fix this by properly doing sb_start_write/sb_end_write to prevent us
from fsfreeze.

Note that with this patch syncfs will block on the frozen file system
which is probably ok, but sync will block if any file system happens to
be frozen - not sure if that's a problem, but it's certainly different
from what we've been used to.

Signed-off-by: Tariq Saeed <tariq.x.saeed@oracle.com>
fs/super.c
fs/sync.c