linux/fs/ocfs2
Wengang Wang 9c339255cb ocfs2: pass "new" parameter to ocfs2_init_xattr_bucket
This patch fixes the following crash:

  kernel BUG at fs/ocfs2/uptodate.c:530!
  Modules linked in: ocfs2(F) ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs bridge xen_pciback xen_netback xen_blkback xen_gntalloc xen_gntdev xen_evtchn xenfs xen_privcmd sunrpc 8021q garp stp llc bonding be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi iTCO_wdt iTCO_vendor_support dcdbas coretemp freq_table mperf microcode pcspkr serio_raw bnx2 lpc_ich mfd_core i5k_amb i5000_edac edac_core e1000e sg shpchp ext4(F) jbd2(F) mbcache(F) dm_round_robin(F) sr_mod(F) cdrom(F) usb_storage(F) sd_mod(F) crc_t10dif(F) pata_acpi(F) ata_generic(F) ata_piix(F) mptsas(F) mptscsih(F) mptbase(F) scsi_transport_sas(F) radeon(F)
   ttm(F) drm_kms_helper(F) drm(F) hwmon(F) i2c_algo_bit(F) i2c_core(F) dm_multipath(F) dm_mirror(F) dm_region_hash(F) dm_log(F) dm_mod(F)
  CPU 5
  Pid: 21303, comm: xattr-test Tainted: GF       W    3.8.13-30.el6uek.x86_64 #2 Dell Inc. PowerEdge 1950/0M788G
  RIP: ocfs2_set_new_buffer_uptodate+0x51/0x60 [ocfs2]
  Process xattr-test (pid: 21303, threadinfo ffff880017aca000, task ffff880016a2c480)
  Call Trace:
    ocfs2_init_xattr_bucket+0x8a/0x120 [ocfs2]
    ocfs2_cp_xattr_bucket+0xbb/0x1b0 [ocfs2]
    ocfs2_extend_xattr_bucket+0x20a/0x2f0 [ocfs2]
    ocfs2_add_new_xattr_bucket+0x23e/0x4b0 [ocfs2]
    ocfs2_xattr_set_entry_index_block+0x13c/0x3d0 [ocfs2]
    ocfs2_xattr_block_set+0xf9/0x220 [ocfs2]
    __ocfs2_xattr_set_handle+0x118/0x710 [ocfs2]
    ocfs2_xattr_set+0x691/0x880 [ocfs2]
    ocfs2_xattr_user_set+0x46/0x50 [ocfs2]
    generic_setxattr+0x96/0xa0
    __vfs_setxattr_noperm+0x7b/0x170
    vfs_setxattr+0xbc/0xc0
    setxattr+0xde/0x230
    sys_fsetxattr+0xc6/0xf0
    system_call_fastpath+0x16/0x1b
  Code: 41 80 0c 24 01 48 89 df e8 7d f0 ff ff 4c 89 e6 48 89 df e8 a2 fe ff ff 48 89 df e8 3a f0 ff ff 48 8b 1c 24 4c 8b 64 24 08 c9 c3 <0f> 0b eb fe 90 90 90 90 90 90 90 90 90 90 90 55 48 89 e5 66 66
  RIP  ocfs2_set_new_buffer_uptodate+0x51/0x60 [ocfs2]

It hit the BUG_ON() in ocfs2_set_new_buffer_uptodate():

    void ocfs2_set_new_buffer_uptodate(struct ocfs2_caching_info *ci,
                                       struct buffer_head *bh)
    {
          /* This should definitely *not* exist in our cache */
          if (ocfs2_buffer_cached(ci, bh))
                  printk(KERN_ERR "bh->b_blocknr: %lu @ %p\n", bh->b_blocknr, bh);
          BUG_ON(ocfs2_buffer_cached(ci, bh));

          set_buffer_uptodate(bh);

          ocfs2_metadata_cache_io_lock(ci);
          ocfs2_set_buffer_uptodate(ci, bh);
          ocfs2_metadata_cache_io_unlock(ci);
    }

The problem here is:

We cached a block, but the buffer_head got reused.  When we are to pick
up this block again, a new buffer_head created with UPTODATE flag
cleared.  ocfs2_buffer_uptodate() returned false since no UPTODATE is
set on the buffer_head.  so we set this block to cache as a NEW block,
then it failed at asserting block is not in cache.

The fix is to add a new parameter indicating the bucket is a new
allocated or not to ocfs2_init_xattr_bucket().
ocfs2_init_xattr_bucket() assert block not cached accordingly.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-04-03 16:20:57 -07:00
..
cluster ocfs2/o2net: o2net_listen_data_ready should do nothing if socket state is not TCP_LISTEN 2014-04-03 16:20:56 -07:00
dlm ocfs2: fix deadlock risk when kmalloc failed in dlm_query_region_handler 2014-04-03 16:20:55 -07:00
dlmfs ocfs2: remove versioning information 2014-01-21 16:19:41 -08:00
Kconfig ocfs2: Make OCFS2_FS depend on CONFIGFS_FS 2011-01-16 21:22:40 +00:00
Makefile ocfs2: remove versioning information 2014-01-21 16:19:41 -08:00
acl.c ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode 2014-04-03 16:20:56 -07:00
acl.h ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00
alloc.c ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode 2014-04-03 16:20:56 -07:00
alloc.h ocfs2: Add ocfs2_trim_fs for SSD trim support. 2011-05-23 23:37:18 -07:00
aops.c ocfs2: improve fsync efficiency and fix deadlock between aio_write and sync_file 2014-04-03 16:20:53 -07:00
aops.h ocfs2: change ip_unaligned_aio to of type mutex from atomit_t 2014-04-03 16:20:53 -07:00
blockcheck.c ocfs2: kill endianness abuses in blockcheck.c 2012-05-29 23:28:35 -04:00
blockcheck.h ocfs2: Add statistics for the checksum and ecc operations. 2009-06-03 19:15:36 -07:00
buffer_head_io.c ocfs2: do not put bh when buffer_uptodate failed 2014-04-03 16:20:56 -07:00
buffer_head_io.h ocfs2: Take the inode out of the metadata read/write paths. 2009-09-04 16:07:48 -07:00
dcache.c ocfs2: revert iput deferring code in ocfs2_drop_dentry_lock 2014-04-03 16:20:55 -07:00
dcache.h ocfs2: revert iput deferring code in ocfs2_drop_dentry_lock 2014-04-03 16:20:55 -07:00
dir.c ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode 2014-04-03 16:20:56 -07:00
dir.h [readdir] convert ocfs2 2013-06-29 12:57:02 +04:00
dlmglue.c ocfs2: avoid blocking in ocfs2_mark_lockres_freeing() in downconvert thread 2014-04-03 16:20:55 -07:00
dlmglue.h ocfs2: avoid blocking in ocfs2_mark_lockres_freeing() in downconvert thread 2014-04-03 16:20:55 -07:00
export.c fs: encode_fh: return FILEID_INVALID if invalid fid_type 2013-02-26 02:46:10 -05:00
export.h exportfs: make struct export_operations const 2007-10-22 08:13:21 -07:00
extent_map.c ocfs2: fix the end cluster offset of FIEMAP 2013-09-11 15:56:53 -07:00
extent_map.h ocfs2: Implement llseek() 2011-07-25 14:58:15 -07:00
file.c ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode 2014-04-03 16:20:56 -07:00
file.h ->permission() sanitizing: don't pass flags to ->permission() 2011-07-20 01:43:24 -04:00
heartbeat.c ocfs2: Remove mlog(0) from fs/ocfs2/heartbeat.c 2011-02-23 21:17:39 +08:00
heartbeat.h ocfs2: Move o2hb functionality into the stack glue. 2008-04-18 08:56:04 -07:00
inode.c ocfs2: avoid blocking in ocfs2_mark_lockres_freeing() in downconvert thread 2014-04-03 16:20:55 -07:00
inode.h ocfs2: remove OCFS2_INODE_SKIP_DELETE flag 2014-04-03 16:20:54 -07:00
ioctl.c ocfs2: iput inode alloc when failed locally 2014-04-03 16:20:57 -07:00
ioctl.h Ocfs2: Move ocfs2 ioctl definitions from ocfs2_fs.h to newly added ocfs2_ioctl.h 2010-03-02 14:10:20 -08:00
journal.c ocfs2: remove OCFS2_INODE_SKIP_DELETE flag 2014-04-03 16:20:54 -07:00
journal.h ocfs2: improve fsync efficiency and fix deadlock between aio_write and sync_file 2014-04-03 16:20:53 -07:00
localalloc.c ocfs2: free allocated clusters if error occurs after ocfs2_claim_clusters 2014-02-06 13:48:51 -08:00
localalloc.h ocfs2: free allocated clusters if error occurs after ocfs2_claim_clusters 2014-02-06 13:48:51 -08:00
locks.c ocfs2: flock: drop cross-node lock when failed locally 2014-04-03 16:20:56 -07:00
locks.h ocfs2: POSIX file locks support 2008-10-13 13:57:57 -07:00
mmap.c kill f_vfsmnt 2013-02-26 02:46:10 -05:00
mmap.h
move_extents.c ocfs2: rollback alloc_dinode counts when ocfs2_block_group_set_bits() failed 2014-04-03 16:20:56 -07:00
move_extents.h Ocfs2/move_extents: move/defrag extents within a certain range. 2011-05-25 15:17:12 +08:00
namei.c ocfs2: call ocfs2_update_inode_fsync_trans when updating any inode 2014-04-03 16:20:56 -07:00
namei.h ocfs2: Create reflinked file in orphan dir. 2009-09-22 20:09:48 -07:00
ocfs1_fs_compat.h fs/: Spelling fixes 2008-02-03 17:33:42 +02:00
ocfs2.h ocfs2: avoid system inode ref confusion by adding mutex lock 2014-04-03 16:20:57 -07:00
ocfs2_fs.h Revert wrong fixes for common misspellings 2011-04-26 23:31:11 -07:00
ocfs2_ioctl.h Ocfs2/move_extents: Adding new ioctl code 'OCFS2_IOC_MOVE_EXT' to ocfs2. 2011-05-25 15:17:08 +08:00
ocfs2_lockid.h ocfs2: Add new refcount tree lock resource in dlmglue. 2009-09-22 20:09:28 -07:00
ocfs2_lockingver.h ocfs2_dlmfs: Enable the use of user cluster stacks. 2010-02-26 15:41:18 -08:00
ocfs2_trace.h ocfs2: lighten up allocate transaction 2013-09-11 15:56:28 -07:00
quota.h ocfs2: implement delayed dropping of last dquot reference 2014-04-03 16:20:54 -07:00
quota_global.c ocfs2: implement delayed dropping of last dquot reference 2014-04-03 16:20:54 -07:00
quota_local.c ocfs2: fix quota file corruption 2014-03-04 07:55:48 -08:00
refcounttree.c ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00
refcounttree.h ocfs2: fix NULL pointer dereference in ocfs2_duplicate_clusters_by_page 2013-08-13 17:57:49 -07:00
reservations.c ocfs2: Remove masklog ML_RESERVATIONS. 2011-02-23 22:10:56 +08:00
reservations.h Fix common misspellings 2011-03-31 11:26:23 -03:00
resize.c ocfs2: do not call brelse() if group_bh is not initialized in ocfs2_group_add() 2013-11-13 12:09:01 +09:00
resize.h [PATCH 2/2] ocfs2: Implement group add for online resize 2008-01-25 15:04:24 -08:00
slot_map.c ocfs2: Clean up messages in the fs 2011-07-24 10:34:54 -07:00
slot_map.h ocfs2: De-magic the in-memory slot map. 2008-04-18 08:56:03 -07:00
stack_o2cb.c ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node 2014-01-21 16:19:41 -08:00
stack_user.c ocfs2: fix sparse non static symbol warning 2014-01-21 16:19:42 -08:00
stackglue.c ocfs2: add dlm_recover_callback_support in sysfs 2014-04-03 16:20:54 -07:00
stackglue.h ocfs2: pass ocfs2_cluster_connection to ocfs2_this_node 2014-01-21 16:19:41 -08:00
suballoc.c ocfs2: iput inode alloc when failed locally 2014-04-03 16:20:57 -07:00
suballoc.h ocfs2: rollback alloc_dinode counts when ocfs2_block_group_set_bits() failed 2014-04-03 16:20:56 -07:00
super.c ocfs2: avoid system inode ref confusion by adding mutex lock 2014-04-03 16:20:57 -07:00
super.h treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
symlink.c ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path 2013-02-26 02:46:12 -05:00
symlink.h ocfs: simplify symlink handling 2012-05-29 23:28:40 -04:00
sysfile.c ocfs2: avoid system inode ref confusion by adding mutex lock 2014-04-03 16:20:57 -07:00
sysfile.h
uptodate.c ocfs2: Remove masklog ML_UPTODATE. 2011-02-24 16:22:20 +08:00
uptodate.h ocfs2: Pass struct ocfs2_caching_info to the journal functions. 2009-09-04 16:07:50 -07:00
xattr.c ocfs2: pass "new" parameter to ocfs2_init_xattr_bucket 2014-04-03 16:20:57 -07:00
xattr.h ocfs2: use generic posix ACL infrastructure 2014-01-25 23:58:21 -05:00