From patchwork Mon Dec 10 18:07:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [precise,sru] pull-request: fsnotify: simplify locking From: Chris J Arges X-Patchwork-Id: 205004 Message-Id: <50C624EB.3020004@canonical.com> To: Ubuntu Kernel Team Date: Mon, 10 Dec 2012 12:07:39 -0600 BugLink: http://bugs.launchpad.net/bugs/922906 SRU Justification: Impact: When plugging and unplugging a USB drive occasionally a race condition in the notify subsystem causes a kernel oops. A more in depth explaining can be found here: https://lkml.org/lkml/2011/1/19/213. Fix: A set up of patches 0520bffba9685d88ad68ede4a41abd08a3e9684e..fe9b25d3ee6bdf6f9c9a9ce61d9d3e144bac13ef found in the for-next branch in the notify.git tree solve this issue: http://git.infradead.org/users/eparis/notify.git/shortlog/refs/heads/for-next These have been cherry-picked and tested on precise/quantal and applied already to raring. Only small modifications are needed for 2 of the patches because the locations of the functions had changed other than that the other 7 patches are clean cherry-picks. Testcase: Comment #8 and #9 in the upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=22602 has a test case that easily reproduces this issue within 15-30 minutes. I have applied the above fixes and was able to run this test case overnight in all cases. In addition I've tested using the LTP tests for inotfy and these run properly with the fix applied. --- The following changes since commit ba6c2f688e255a1f52f2930ae9e6d62ede804289: UBUNTU: Ubuntu-3.2.0-34.53 (2012-11-14 15:50:53 +0000) are available in the git repository at: git://kernel.ubuntu.com/arges/ubuntu-precise.git lp922906 for you to fetch changes up to 937c3c88ab712f93548a321566e5d85a11664291: UBUNTU: SAUCE: fsnotify: dont put marks on temporary list when clearing marks by group (2012-12-07 15:19:03 -0600) ---------------------------------------------------------------- Lino Sanfilippo (8): UBUNTU: SAUCE: fsnotify: introduce fsnotify_get_group() UBUNTU: SAUCE: fsnotify: use reference counting for groups UBUNTU: SAUCE: fsnotify: take groups mark_lock before mark lock UBUNTU: SAUCE: fanotify: add an extra flag to mark_remove_from_mask that indicates wheather a mark should be destroyed UBUNTU: SAUCE: fsnotify: use a mutex instead of a spinlock to protect a groups mark list UBUNTU: SAUCE: fsnotify: pass group to fsnotify_destroy_mark() UBUNTU: SAUCE: fsnotify: introduce locked versions of fsnotify_add_mark() and fsnotify_remove_mark() UBUNTU: SAUCE: fsnotify: dont put marks on temporary list when clearing marks by group fs/notify/dnotify/dnotify.c | 4 +- fs/notify/fanotify/fanotify_user.c | 19 +++++--- fs/notify/group.c | 38 ++++++++-------- fs/notify/inode_mark.c | 14 ++++-- fs/notify/inotify/inotify_fsnotify.c | 4 +- fs/notify/inotify/inotify_user.c | 3 +- fs/notify/mark.c | 81 +++++++++++++++++++--------------- fs/notify/vfsmount_mark.c | 14 ++++-- include/linux/fsnotify_backend.h | 16 ++++--- kernel/audit_tree.c | 10 ++--- kernel/audit_watch.c | 4 +- 11 files changed, 125 insertions(+), 82 deletions(-)