From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Jeff Mahoney <jeffm@suse.com>, Jan Kara <jack@suse.cz>,
Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 58/70] reiserfs: fix deadlock with nfs racing on create/lookup
Date: Tue, 4 Jun 2013 15:07:14 +0100 [thread overview]
Message-ID: <1370354846-14213-59-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1370354846-14213-1-git-send-email-luis.henriques@canonical.com>
3.5.7.14 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <jeffm@suse.com>
commit a1457c0ce976bad1356b9b0437f2a5c3ab8a9cfc upstream.
Reiserfs is currently able to be deadlocked by having two NFS clients
where one has removed and recreated a file and another is accessing the
file with an open file handle.
If one client deletes and recreates a file with timing such that the
recreated file obtains the same [dirid, objectid] pair as the original
file while another client accesses the file via file handle, the create
and lookup can race and deadlock if the lookup manages to create the
in-memory inode first.
The create thread, in insert_inode_locked4, will hold the write lock
while waiting on the other inode to be unlocked. The lookup thread,
anywhere in the iget path, will release and reacquire the write lock while
it schedules. If it needs to reacquire the lock while the create thread
has it, it will never be able to make forward progress because it needs
to reacquire the lock before ultimately unlocking the inode.
This patch drops the write lock across the insert_inode_locked4 call so
that the ordering of inode_wait -> write lock is retained. Since this
would have been the case before the BKL push-down, this is safe.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
fs/reiserfs/inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 210f70e..591b79f 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1810,11 +1810,16 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE);
args.dirid = le32_to_cpu(ih.ih_key.k_dir_id);
- if (insert_inode_locked4(inode, args.objectid,
- reiserfs_find_actor, &args) < 0) {
+
+ reiserfs_write_unlock(inode->i_sb);
+ err = insert_inode_locked4(inode, args.objectid,
+ reiserfs_find_actor, &args);
+ reiserfs_write_lock(inode->i_sb);
+ if (err) {
err = -EINVAL;
goto out_bad_inode;
}
+
if (old_format_only(sb))
/* not a perfect generation count, as object ids can be reused, but
** this is as good as reiserfs can do right now.
--
1.8.1.2
next prev parent reply other threads:[~2013-06-04 14:13 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 14:06 [ 3.5.y.z extended stable ] Linux 3.5.7.14 stable review Luis Henriques
2013-06-04 14:06 ` [PATCH 01/70] hwmon: fix error return code in abituguru_probe() Luis Henriques
2013-06-04 14:06 ` [PATCH 02/70] i2c: designware: fix RX FIFO overrun Luis Henriques
2013-06-04 14:06 ` [PATCH 03/70] i2c: designware: always clear interrupts before enabling them Luis Henriques
2013-06-04 14:06 ` [PATCH 04/70] btrfs: don't stop searching after encountering the wrong item Luis Henriques
2013-06-04 14:06 ` [PATCH 05/70] drm/radeon: Fix VRAM size calculation for VRAM >= 4GB Luis Henriques
2013-06-04 14:06 ` [PATCH 06/70] mantis: fix silly crash case Luis Henriques
2013-06-04 14:06 ` [PATCH 07/70] avr32: fix relocation check for signed 18-bit offset Luis Henriques
2013-06-04 14:06 ` [PATCH 08/70] virtio_console: fix uapi header Luis Henriques
2013-06-04 14:06 ` [PATCH 09/70] Input: egalax_ts - ABS_MT_POSITION_Y not reported well Luis Henriques
2013-06-04 14:06 ` [PATCH 10/70] staging: vt6656: use free_netdev instead of kfree Luis Henriques
2013-06-04 14:06 ` [PATCH 11/70] USB: xHCI: override bogus bulk wMaxPacketSize values Luis Henriques
2013-06-04 14:06 ` [PATCH 12/70] USB: UHCI: fix for suspend of virtual HP controller Luis Henriques
2013-06-04 14:06 ` [PATCH 13/70] USB: reset resume quirk needed by a hub Luis Henriques
2013-06-04 14:06 ` [PATCH 14/70] usb: option: Add Telewell TW-LTE 4G Luis Henriques
2013-06-04 14:06 ` [PATCH 15/70] USB: Blacklisted Cinterion's PLxx WWAN Interface Luis Henriques
2013-06-04 14:06 ` [PATCH 16/70] USB: option: add device IDs for Dell 5804 (Novatel E371) WWAN card Luis Henriques
2013-06-04 14:06 ` [PATCH 17/70] USB: ftdi_sio: Add support for Newport CONEX motor drivers Luis Henriques
2013-06-04 14:06 ` [PATCH 18/70] USB: cxacru: potential underflow in cxacru_cm_get_array() Luis Henriques
2013-06-04 14:06 ` [PATCH 19/70] TTY: Fix tty miss restart after we turn off flow-control Luis Henriques
2013-06-04 14:06 ` [PATCH 20/70] cifs: only set ops for inodes in I_NEW state Luis Henriques
2013-06-04 14:06 ` [PATCH 21/70] Kirkwood: Enable PCIe port 1 on QNAP TS-11x/TS-21x Luis Henriques
2013-06-04 14:06 ` [PATCH 22/70] mac80211: fix AP-mode frame matching Luis Henriques
2013-06-04 14:06 ` [PATCH 23/70] ARM: plat-orion: Fix num_resources and id for ge10 and ge11 Luis Henriques
2013-06-04 14:06 ` [PATCH 24/70] sunrpc: clarify comments on rpc_make_runnable Luis Henriques
2013-06-04 14:06 ` [PATCH 25/70] SUNRPC: Prevent an rpc_task wakeup race Luis Henriques
2013-06-04 14:06 ` [PATCH 26/70] perf: net_dropmonitor: Fix trace parameter order Luis Henriques
2013-06-04 14:06 ` [PATCH 27/70] perf: net_dropmonitor: Fix symbol-relative addresses Luis Henriques
2013-06-04 14:06 ` [PATCH 28/70] fat: fix possible overflow for fat_clusters Luis Henriques
2013-06-04 14:06 ` [PATCH 29/70] wait: fix false timeouts when using wait_event_timeout() Luis Henriques
2013-06-04 14:06 ` [PATCH 30/70] rapidio/tsi721: fix bug in MSI interrupt handling Luis Henriques
2013-06-04 14:06 ` [PATCH 31/70] mm compaction: fix of improper cache flush in migration code Luis Henriques
2013-06-04 14:06 ` [PATCH 32/70] mm/THP: use pmd_populate() to update the pmd with pgtable_t pointer Luis Henriques
2013-06-04 14:06 ` [PATCH 33/70] drivers/leds/leds-ot200.c: fix error caused by shifted mask Luis Henriques
2013-06-04 14:06 ` [PATCH 34/70] drivers/block/brd.c: fix brd_lookup_page() race Luis Henriques
2013-06-04 14:06 ` [PATCH 35/70] nilfs2: fix issue of nilfs_set_page_dirty() for page at EOF boundary Luis Henriques
2013-06-04 14:06 ` [PATCH 36/70] random: fix accounting race condition with lockless irq entropy_count update Luis Henriques
2013-06-04 14:06 ` [PATCH 37/70] ocfs2: goto out_unlock if ocfs2_get_clusters_nocache() failed in ocfs2_fiemap() Luis Henriques
2013-06-04 14:06 ` [PATCH 38/70] mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas Luis Henriques
2013-06-04 14:06 ` [PATCH 39/70] staging:iio:light:tsl2x7x: fix the error handling in tsl2x7x_probe() Luis Henriques
2013-06-04 14:06 ` [PATCH 40/70] mwifiex: fix memory leak issue when driver unload Luis Henriques
2013-06-04 14:06 ` [PATCH 41/70] dm bufio: avoid a possible __vmalloc deadlock Luis Henriques
2013-06-04 14:06 ` [PATCH 42/70] tg3: Skip powering down function 0 on certain serdes devices Luis Henriques
2013-06-04 14:06 ` [PATCH 43/70] acpi/video_detect: blacklist samsung x360 Luis Henriques
2013-06-04 14:07 ` [PATCH 44/70] ACPI / video: Add "Asus UL30VT" to ACPI video detect blacklist Luis Henriques
2013-06-04 14:07 ` [PATCH 45/70] ACPI / video: Add "Asus UL30A" " Luis Henriques
2013-06-04 14:07 ` [PATCH 46/70] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU Luis Henriques
2013-06-04 14:07 ` [PATCH 47/70] sched/debug: Limit sd->*_idx range on sysctl Luis Henriques
2013-06-04 14:07 ` [PATCH 48/70] sched/debug: Fix sd->*_idx limit range avoiding overflow Luis Henriques
2013-06-04 14:07 ` [PATCH 49/70] ipvs: ip_vs_sip_fill_param() BUG: bad check of return value Luis Henriques
2013-06-04 14:07 ` [PATCH 50/70] jfs: fix a couple races Luis Henriques
2013-06-04 14:07 ` [PATCH 51/70] cifs: fix potential buffer overrun when composing a new options string Luis Henriques
2013-06-04 14:07 ` [PATCH 52/70] ASoC: cs42l52: fix default value for MASTERA_VOL Luis Henriques
2013-06-04 14:07 ` [PATCH 53/70] drm/radeon: fix typo in cu_per_sh on verde Luis Henriques
2013-06-04 14:07 ` [PATCH 54/70] drm/radeon: fix card_posted check for newer asics Luis Henriques
2013-06-04 14:07 ` [PATCH 55/70] NFSv4: Fix a thinko in nfs4_try_open_cached Luis Henriques
2013-06-04 14:07 ` [PATCH 56/70] xfs: kill suid/sgid through the truncate path Luis Henriques
2013-06-04 14:07 ` [PATCH 57/70] iscsi-target: fix heap buffer overflow on error Luis Henriques
2013-06-04 14:07 ` Luis Henriques [this message]
2013-06-04 14:07 ` [PATCH 59/70] reiserfs: fix problems with chowning setuid file w/ xattrs Luis Henriques
2013-06-04 14:07 ` [PATCH 60/70] reiserfs: fix spurious multiple-fill in reiserfs_readdir_dentry Luis Henriques
2013-06-04 14:07 ` [PATCH 61/70] xen-netback: remove skb in xen_netbk_alloc_page Luis Henriques
2013-06-04 14:07 ` [PATCH 62/70] xen-netback: fix sparse warning Luis Henriques
2013-06-04 14:07 ` [PATCH 63/70] xen-netback: coalesce slots in TX path and fix regressions Luis Henriques
2013-06-04 14:07 ` [PATCH 64/70] xen-netback: don't disconnect frontend when seeing oversize packet Luis Henriques
2013-06-04 14:07 ` [PATCH 65/70] xen-netback: remove redundent parameter in netbk_count_requests Luis Henriques
2013-06-04 14:07 ` [PATCH 66/70] xen-netback: avoid allocating variable size array on stack Luis Henriques
2013-06-04 14:07 ` [PATCH 67/70] xen-netback: better names for thresholds Luis Henriques
2013-06-04 14:07 ` [PATCH 68/70] xen-netfront: remove unused variable `extra' Luis Henriques
2013-06-04 14:07 ` [PATCH 69/70] xen-netfront: frags -> slots in xennet_get_responses Luis Henriques
2013-06-04 14:07 ` [PATCH 70/70] xen-netfront: frags -> slots in log message Luis Henriques
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370354846-14213-59-git-send-email-luis.henriques@canonical.com \
--to=luis.henriques@canonical.com \
--cc=jack@suse.cz \
--cc=jeffm@suse.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®