From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org,
"Sunil Mushran" <sunil.mushran@gmail.com>,
"Joel Becker" <jlbec@evilplan.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Mark Fasheh" <mfasheh@suse.com>, "Jie Liu" <jeff.liu@oracle.com>,
"Junxiao Bi" <junxiao.bi@oracle.com>
Subject: [66/85] ocfs2: xattr: fix inlined xattr reflink
Date: Wed, 24 Jul 2013 15:02:45 +0100 [thread overview]
Message-ID: <lsq.1374674565.134867544@decadent.org.uk> (raw)
In-Reply-To: <lsq.1374674564.753305150@decadent.org.uk>
3.2.49-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <junxiao.bi@oracle.com>
commit ef962df057aaafd714f5c22ba3de1be459571fdf upstream.
Inlined xattr shared free space of inode block with inlined data or data
extent record, so the size of the later two should be adjusted when
inlined xattr is enabled. See ocfs2_xattr_ibody_init(). But this isn't
done well when reflink. For inode with inlined data, its max inlined
data size is adjusted in ocfs2_duplicate_inline_data(), no problem. But
for inode with data extent record, its record count isn't adjusted. Fix
it, or data extent record and inlined xattr may overwrite each other,
then cause data corruption or xattr failure.
One panic caused by this bug in our test environment is the following:
kernel BUG at fs/ocfs2/xattr.c:1435!
invalid opcode: 0000 [#1] SMP
Pid: 10871, comm: multi_reflink_t Not tainted 2.6.39-300.17.1.el5uek #1
RIP: ocfs2_xa_offset_pointer+0x17/0x20 [ocfs2]
RSP: e02b:ffff88007a587948 EFLAGS: 00010283
RAX: 0000000000000000 RBX: 0000000000000010 RCX: 00000000000051e4
RDX: ffff880057092060 RSI: 0000000000000f80 RDI: ffff88007a587a68
RBP: ffff88007a587948 R08: 00000000000062f4 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000010
R13: ffff88007a587a68 R14: 0000000000000001 R15: ffff88007a587c68
FS: 00007fccff7f06e0(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
CS: e033 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000000015cf000 CR3: 000000007aa76000 CR4: 0000000000000660
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process multi_reflink_t
Call Trace:
ocfs2_xa_reuse_entry+0x60/0x280 [ocfs2]
ocfs2_xa_prepare_entry+0x17e/0x2a0 [ocfs2]
ocfs2_xa_set+0xcc/0x250 [ocfs2]
ocfs2_xattr_ibody_set+0x98/0x230 [ocfs2]
__ocfs2_xattr_set_handle+0x4f/0x700 [ocfs2]
ocfs2_xattr_set+0x6c6/0x890 [ocfs2]
ocfs2_xattr_user_set+0x46/0x50 [ocfs2]
generic_setxattr+0x70/0x90
__vfs_setxattr_noperm+0x80/0x1a0
vfs_setxattr+0xa9/0xb0
setxattr+0xc3/0x120
sys_fsetxattr+0xa8/0xd0
system_call_fastpath+0x16/0x1b
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Sunil Mushran <sunil.mushran@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
fs/ocfs2/xattr.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -6499,6 +6499,16 @@ static int ocfs2_reflink_xattr_inline(st
}
new_oi = OCFS2_I(args->new_inode);
+ /*
+ * Adjust extent record count to reserve space for extended attribute.
+ * Inline data count had been adjusted in ocfs2_duplicate_inline_data().
+ */
+ if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
+ !(ocfs2_inode_is_fast_symlink(args->new_inode))) {
+ struct ocfs2_extent_list *el = &new_di->id2.i_list;
+ le16_add_cpu(&el->l_count, -(inline_size /
+ sizeof(struct ocfs2_extent_rec)));
+ }
spin_lock(&new_oi->ip_lock);
new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL;
new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features);
next prev parent reply other threads:[~2013-07-24 14:20 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 14:02 [00/85] 3.2.49-rc1 review Ben Hutchings
2013-07-24 14:02 ` [75/85] perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario Ben Hutchings
2013-07-24 14:02 ` [49/85] genirq: Fix can_request_irq() for IRQs without an action Ben Hutchings
2013-07-24 14:02 ` [67/85] block: do not pass disk names as format strings Ben Hutchings
2013-07-24 14:02 ` [18/85] ath9k: fill channel mode in caldata Ben Hutchings
2013-07-24 14:02 ` [50/85] writeback: Fix periodic writeback after fs mount Ben Hutchings
2013-07-24 14:02 ` [73/85] iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow Ben Hutchings
2013-07-24 14:02 ` [02/85] printk: Fix rq->lock vs logbuf_lock unlock lock inversion Ben Hutchings
2013-07-24 14:02 ` [01/85] r8169: fix offloaded tx checksum for small packets Ben Hutchings
2013-07-24 14:02 ` [26/85] drivers: hv: switch to use mb() instead of smp_mb() Ben Hutchings
2013-07-24 14:02 ` [57/85] ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree() Ben Hutchings
2013-07-24 14:02 ` [08/85] zram: avoid invalid memory access in zram_exit() Ben Hutchings
2013-07-24 14:02 ` [65/85] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() Ben Hutchings
2013-07-24 14:02 ` [37/85] [SCSI] mpt2sas: fix firmware failure with wrong task attribute Ben Hutchings
2013-07-24 14:02 ` [40/85] net/tg3: Avoid delay during MMIO access Ben Hutchings
2013-07-24 16:42 ` Luis Henriques
2013-07-24 19:45 ` David Miller
2013-07-24 21:09 ` David Miller
2013-07-25 4:16 ` Ben Hutchings
2013-07-25 21:03 ` Greg KH
2013-07-25 4:15 ` Ben Hutchings
2013-07-24 14:02 ` [09/85] zram: use zram->lock to protect zram_free_page() in swap free notify path Ben Hutchings
2013-07-24 14:02 ` [38/85] USB: option,qcserial: move Novatel Gobi1K IDs to qcserial Ben Hutchings
2013-07-24 14:02 ` [31/85] ahci: AHCI-mode SATA patch for Intel Coleto Creek DeviceIDs Ben Hutchings
2013-07-24 14:02 ` [45/85] cgroup: fix RCU accesses to task->cgroups Ben Hutchings
2013-07-24 14:02 ` [22/85] ASoC: wm8962: Remove remaining direct register cache accesses Ben Hutchings
2013-07-24 14:02 ` Ben Hutchings [this message]
2013-07-24 14:02 ` [80/85] pch_uart: fix a deadlock when pch_uart as console Ben Hutchings
2013-07-24 14:02 ` [03/85] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down Ben Hutchings
2013-07-24 14:02 ` [44/85] [SCSI] sd: Fix parsing of 'temporary ' cache mode prefix Ben Hutchings
2013-07-24 14:02 ` [39/85] futex: Take hugepages into account when generating futex_key Ben Hutchings
2013-07-24 14:02 ` [81/85] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware Ben Hutchings
2013-07-24 14:02 ` [52/85] xen/time: remove blocked time accounting from xen "clockchip" Ben Hutchings
2013-07-24 14:02 ` [72/85] [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries Ben Hutchings
2013-07-24 14:02 ` [24/85] ALSA: hda - Cache the MUX selection for generic HDMI Ben Hutchings
2013-07-24 14:02 ` [23/85] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND Ben Hutchings
2013-07-24 14:02 ` [20/85] ath9k: Do not assign noise for NULL caldata Ben Hutchings
2013-07-24 14:02 ` [35/85] [SCSI] mpt2sas: Fix for issue Missing delay not getting set during system bootup Ben Hutchings
2013-07-24 14:02 ` [25/85] xhci: check for failed dma pool allocation Ben Hutchings
2013-07-24 14:02 ` [53/85] UBIFS: prepare to fix a horrid bug Ben Hutchings
2013-07-24 14:02 ` [42/85] perf: Disable monitoring on setuid processes for regular users Ben Hutchings
2013-07-24 14:02 ` [79/85] perf: Fix mmap() accounting hole Ben Hutchings
2013-07-24 14:02 ` [47/85] dlci: acquire rtnl_lock before calling __dev_get_by_name() Ben Hutchings
2013-07-24 14:02 ` [46/85] Handle big endianness in NTLM (ntlmv2) authentication Ben Hutchings
2013-07-24 14:02 ` [61/85] HID: Add support for the MacBook Pro 10,2 keyboard / touchpad Ben Hutchings
2013-07-24 14:02 ` [15/85] libata: skip SRST for all SIMG [34]7x port-multipliers Ben Hutchings
2013-07-24 14:02 ` [84/85] MAINTAINERS: Greg's suse email address is dead Ben Hutchings
2013-07-24 14:02 ` [13/85] ahci: remove pmp link online check in FBS EH Ben Hutchings
2013-07-24 14:02 ` [12/85] zram: protect sysfs handler from invalid memory access Ben Hutchings
2013-07-24 14:02 ` [10/85] zram: destroy all devices on error recovery path in zram_init() Ben Hutchings
2013-07-24 14:02 ` [63/85] Input: bcm5974 - add support for the 2013 MacBook Air Ben Hutchings
2013-07-25 6:48 ` rydberg
2013-07-24 14:02 ` [69/85] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq Ben Hutchings
2013-07-24 14:02 ` [82/85] ext4: fix overflow when counting used blocks on 32-bit architectures Ben Hutchings
2013-07-24 14:02 ` [07/85] i2c-piix4: Add AMD CZ SMBus device ID Ben Hutchings
2013-07-24 14:02 ` [19/85] ath9k: Fix noisefloor calibration Ben Hutchings
2013-07-24 14:02 ` [83/85] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs Ben Hutchings
2013-07-24 14:02 ` [71/85] hpfs: better test for errors Ben Hutchings
2013-07-24 14:02 ` [51/85] timer: Fix jiffies wrap behavior of round_jiffies_common() Ben Hutchings
2013-07-24 14:02 ` [64/85] libceph: Fix NULL pointer dereference in auth client code Ben Hutchings
2013-07-24 14:02 ` [32/85] Bluetooth: Fix invalid length check in l2cap_information_rsp() Ben Hutchings
2013-07-24 14:02 ` [34/85] ARM: 7765/1: perf: Record the user-mode PC in the call chain Ben Hutchings
2013-07-24 14:02 ` [04/85] [SCSI] zfcp: block queue limits with data router Ben Hutchings
2013-07-24 14:02 ` [68/85] crypto: sanitize argument for format string Ben Hutchings
2013-07-24 14:02 ` [54/85] UBIFS: fix a horrid bug Ben Hutchings
2013-07-24 14:02 ` [78/85] perf: Fix perf mmap bugs Ben Hutchings
2013-07-24 14:02 ` [17/85] ath9k_hw: Assign default xlna config for AR9485 Ben Hutchings
2013-07-24 14:02 ` [21/85] Bluetooth: Fix crash in l2cap_build_cmd() with small MTU Ben Hutchings
2013-07-24 14:02 ` [27/85] [media] media: dmxdev: remove dvb_ringbuffer_flush() on writer side Ben Hutchings
2013-07-24 14:02 ` [14/85] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed Ben Hutchings
2013-07-24 14:02 ` [11/85] zram: avoid access beyond the zram device Ben Hutchings
2013-07-24 14:02 ` [41/85] vgacon.c: add cond reschedule points in vgacon_do_font_op Ben Hutchings
2013-07-24 14:02 ` [77/85] ceph: fix statvfs fr_size Ben Hutchings
2013-07-24 14:02 ` [36/85] [SCSI] mpt2sas: Fix for device scan following host reset could get stuck in a infinite loop Ben Hutchings
2013-07-24 14:02 ` [05/85] [SCSI] zfcp: status read buffers on first adapter open with link down Ben Hutchings
2013-07-24 14:02 ` [62/85] HID: apple: Add support for the 2013 Macbook Air Ben Hutchings
2013-07-25 6:50 ` rydberg
2013-07-26 2:49 ` Ben Hutchings
2013-07-24 14:02 ` [33/85] iommu/amd: Only unmap large pages from the first pte Ben Hutchings
2013-07-24 14:02 ` [85/85] MAINTAINERS: add stable_kernel_rules.txt to stable maintainer information Ben Hutchings
2013-07-24 14:02 ` [60/85] tracing: Fix irqs-off tag display in syscall tracing Ben Hutchings
2013-07-24 14:02 ` [43/85] [SCSI] sd: fix array cache flushing bug causing performance problems Ben Hutchings
2013-07-24 14:02 ` [30/85] ata_piix: IDE-mode SATA patch for Intel Coleto Creek DeviceIDs Ben Hutchings
2013-07-24 14:02 ` [29/85] hw_breakpoint: Use cpu_possible_mask in {reserve,release}_bp_slot() Ben Hutchings
2013-07-24 14:02 ` [55/85] Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller" Ben Hutchings
2013-07-24 14:02 ` [56/85] powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries Ben Hutchings
2013-07-24 14:02 ` [74/85] perf: Clone child context from parent context pmu Ben Hutchings
2013-07-24 14:02 ` [06/85] ahci: Add AMD CZ SATA device ID Ben Hutchings
2013-07-24 14:02 ` [59/85] nfsd4: fix decoding of compounds across page boundaries Ben Hutchings
2013-07-24 14:02 ` [16/85] b43: ensue that BCMA is "y" when B43 is "y" Ben Hutchings
2013-09-09 18:01 ` Steven Rostedt
2013-09-09 18:39 ` Ben Hutchings
2013-09-09 18:46 ` Steven Rostedt
2013-09-09 20:56 ` Konstantin Ryabitsev
2013-09-11 1:00 ` Ben Hutchings
2013-07-24 14:02 ` [58/85] jbd2: fix theoretical race in jbd2__journal_restart Ben Hutchings
2013-07-24 14:02 ` [76/85] perf: Fix perf_lock_task_context() vs RCU Ben Hutchings
2013-07-24 14:02 ` [70/85] nbd: correct disconnect behavior Ben Hutchings
2013-07-24 14:02 ` [48/85] dlci: validate the net device in dlci_del() Ben Hutchings
2013-07-24 14:11 ` [00/85] 3.2.49-rc1 review Ben Hutchings
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=lsq.1374674565.134867544@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=jeff.liu@oracle.com \
--cc=jlbec@evilplan.org \
--cc=junxiao.bi@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=stable@vger.kernel.org \
--cc=sunil.mushran@gmail.com \
--cc=torvalds@linux-foundation.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®