All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Chris Mason <chris.mason@oracle.com>,
	David Sterba <dsterba@suse.com>,
	Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [patch 07/66] btrfs: clear_extent_bit error push-up
Date: Wed, 26 Oct 2011 11:18:42 -0400	[thread overview]
Message-ID: <4EA824D2.6070801@suse.com> (raw)
In-Reply-To: <20111026151024.GB5914@twin.jikos.cz>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/26/2011 11:10 AM, David Sterba wrote:
> Hi,
> 
> I've tested it and still crashes in xfstets/113, but this time I
> know what to look for :)
> 
> On Mon, Oct 24, 2011 at 09:02:43PM -0400, Jeff Mahoney wrote:
>> --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -200,10
>> +200,10 @@ void free_extent_state(struct extent_sta int
>> test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, 
>> int bits, int filled, struct extent_state *cached_state); int
>> clear_extent_bits(struct extent_io_tree *tree, u64 start, u64
>> end, -		      int bits, gfp_t mask); +		      int bits, gfp_t
>> mask) __must_check;
> ^^^^^^^^^^^^ this
> 
>> int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64
>> end, -		     int bits, int wake, int delete, struct extent_state
>> **cached, -		     gfp_t mask); +		     int bits, int wake, int
>> delete, +		     struct extent_state **cached, gfp_t mask)
>> __must_check;
> ^^^^^^^^^^^^ this
> 
>> int set_extent_bits(struct extent_io_tree *tree, u64 start, u64
>> end, int bits, gfp_t mask) __must_check; int
>> set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, 
>> @@ -218,7 +218,7 @@ int set_extent_new(struct extent_io_tree int
>> set_extent_dirty(struct extent_io_tree *tree, u64 start, u64
>> end, gfp_t mask) __must_check; int clear_extent_dirty(struct
>> extent_io_tree *tree, u64 start, u64 end, -		       gfp_t mask); 
>> +		       gfp_t mask) __must_check;
> ^^^^^^^^^^^^ shouldn't this be placed at the beginning of the
> prototype?

I don't see why that would need to be the case. It needs to be at the
beginning of the prototype if it's the actual function definition but
not when it's a prototype.

>> @@ -6250,19 +6265,23 @@ static ssize_t btrfs_direct_IO(int rw, s 
>> btrfs_submit_direct, 0);
>> 
>> if (ret < 0 && ret != -EIOCBQUEUED) { -
>> clear_extent_bit(&BTRFS_I(inode)->io_tree, offset, -
>> offset + iov_length(iov, nr_segs) - 1, -			      EXTENT_LOCKED |
>> write_bits, 1, 0, -			      &cached_state, GFP_NOFS); +		ret =
>> clear_extent_bit(&BTRFS_I(inode)->io_tree, offset, +
>> offset + iov_length(iov, nr_segs) - 1, +				       EXTENT_LOCKED
>> | write_bits, 1, 0, +				       &cached_state, GFP_NOFS); +
>> BUG_ON(ret < 0); +		ret = 0;
> ^^^^^^^^ this
> 
>> } else if (ret >= 0 && ret < iov_length(iov, nr_segs)) { /* *
>> We're falling back to buffered, unlock the section we didn't * do
>> IO on. */ -		clear_extent_bit(&BTRFS_I(inode)->io_tree, offset +
>> ret, -			      offset + iov_length(iov, nr_segs) - 1, -
>> EXTENT_LOCKED | write_bits, 1, 0, -			      &cached_state,
>> GFP_NOFS); +		ret = clear_extent_bit(&BTRFS_I(inode)->io_tree,
>> offset + ret, +				       offset + iov_length(iov, nr_segs) - 1, 
>> +				       EXTENT_LOCKED | write_bits, 1, 0, +
>> &cached_state, GFP_NOFS); +		BUG_ON(ret < 0); +		ret = 0;
> ^^^^^^^^
> 
> and this clobber the original ret value which is returned a few
> lines below and used in the caller.
> 
>> } out: free_extent_state(cached_state);
> 
> return ret; }

*smack*

Ugh. You're right. It avoids the corruption but signals a short write.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOqCTSAAoJEB57S2MheeWyV7kP/RvVD7qI4clRtXlmw4MI7WwA
xzdc6bykBe6hV3/lhXmsIW0T1ox6x2OazS7d+jp3tGcrBo8NcVuXa9hM40/YtP3y
drbF3aP0eNOs35qxFTehjCh5ZZH/U8+S9EWNSklbIYKwko2hBVSV/0q7G7VFJPa/
GwzNRc+QWXTKNwwNMiONXwCMw/wDA0w2i2zsBr+Rf4HCRb4WHzslFFlqQvc9eD1b
mdE6qIZBLRAkyoPyXpJeMbPRn41PSpEHuOUcKgiYA5t52+b3QNvkyNiPPHNWzIyI
Bf6q8NdEnSPx1idcLTxB8Hh2cV6ITf6SQ6CGZjr1nkF/vJaNX/xip5FaAcDtyhZC
UWeQP0ZiYez86Xz7J/lE/vyP47yqrz8fKRDjCQ35ylF3Ctuf8Lpqjrt8UaawAV7z
VukuuBJ3IxTiUI2IXacKWwrbMO6bKC7WgMOpR/nzETHqE8H8rVKvKiI50S8v140G
dNNOu5BBMw4btqd87edr/J/wXBk5xXJZ29eYkAiaPPt63rpXP+/ppakqCf+AwjyF
3gkyxrj/rYAlRvsLZ6glN3Wowqe3y8Vun9Hq3Occ1+exDtdE7/bh6tVlh1wqaNGo
nZIYPXVBzqmr4ltp0FKJY5vb7MNOeh2QcbKSnSu41s7Xs4pcITyhtbVKxkgWSZlJ
/YDmGztQOu64yUWWm/PR
=BlwO
-----END PGP SIGNATURE-----

  reply	other threads:[~2011-10-26 15:18 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25  1:02 [patch 00/66] [pull] Error handling patchset v5 Jeff Mahoney
2011-10-25  1:02 ` [patch 01/66] btrfs: Add btrfs_panic() Jeff Mahoney
2011-10-25  1:02 ` [patch 02/66] btrfs: Catch locking failures in {set,clear,convert}_extent_bit Jeff Mahoney
2011-10-25  1:02 ` [patch 03/66] btrfs: Panic on bad rbtree operations Jeff Mahoney
2011-10-25  1:02 ` [patch 04/66] btrfs: Simplify btrfs_insert_root Jeff Mahoney
2011-10-25  1:02 ` [patch 05/66] btrfs: set_extent_bit error push-up Jeff Mahoney
2011-10-25  1:02 ` [patch 06/66] btrfs: lock_extent " Jeff Mahoney
2011-10-25  1:02 ` [patch 07/66] btrfs: clear_extent_bit " Jeff Mahoney
2011-10-26 15:10   ` David Sterba
2011-10-26 15:18     ` Jeff Mahoney [this message]
2011-10-26 16:09       ` David Sterba
2011-10-26 16:13         ` Jeff Mahoney
2011-10-31 12:30           ` Ilya Dryomov
2011-10-31 13:00             ` Chris Mason
2011-10-31 13:34               ` Jeff Mahoney
2011-10-27 12:00       ` David Sterba
2011-10-31 15:07         ` David Sterba
2011-10-31 15:41           ` [patch 07/66] btrfs: clear_extent_bit error push-up [other BUG hit] David Sterba
2011-10-25  1:02 ` [patch 08/66] btrfs: convert_extent_bit error push-up Jeff Mahoney
2011-10-25  1:02 ` [patch 09/66] btrfs: unlock_extent " Jeff Mahoney
2011-10-25  1:02 ` [patch 10/66] btrfs: pin_down_extent should return void Jeff Mahoney
2011-10-25  1:02 ` [patch 11/66] btrfs: btrfs_pin_extent error push-up Jeff Mahoney
2011-10-25  1:02 ` [patch 12/66] btrfs: btrfs_drop_snapshot should return int Jeff Mahoney
2011-10-25  1:02 ` [patch 13/66] btrfs: btrfs_start_transaction non-looped error push-up Jeff Mahoney
2011-10-25  1:02 ` [patch 14/66] btrfs: find_and_setup_root " Jeff Mahoney
2011-10-25  1:02 ` [patch 15/66] btrfs: btrfs_update_root " Jeff Mahoney
2011-10-25  1:02 ` [patch 16/66] btrfs: set_range_writeback should return void Jeff Mahoney
2011-10-25  1:02 ` [patch 17/66] btrfs: wait_on_state " Jeff Mahoney
2011-10-25  1:02 ` [patch 18/66] btrfs: wait_extent_bit " Jeff Mahoney
2011-10-25  1:02 ` [patch 19/66] btrfs: __unlock_for_delalloc " Jeff Mahoney
2011-10-25  1:02 ` [patch 20/66] btrfs: check_page_uptodate " Jeff Mahoney
2011-10-25  1:02 ` [patch 21/66] btrfs: check_page_locked " Jeff Mahoney
2011-10-25  1:02 ` [patch 22/66] btrfs: check_page_writeback " Jeff Mahoney
2011-10-25  1:02 ` [patch 23/66] btrfs: clear_extent_buffer_dirty " Jeff Mahoney
2011-10-25  1:03 ` [patch 24/66] btrfs: btrfs_cleanup_fs_uuids " Jeff Mahoney
2011-10-25  1:03 ` [patch 25/66] btrfs: run_scheduled_bios " Jeff Mahoney
2011-10-25  1:03 ` [patch 26/66] btrfs: btrfs_close_extra_devices " Jeff Mahoney
2011-10-25  1:03 ` [patch 27/66] btrfs: schedule_bio " Jeff Mahoney
2011-10-25  1:03 ` [patch 28/66] btrfs: fill_device_from_item " Jeff Mahoney
2011-10-25  1:03 ` [patch 29/66] btrfs: btrfs_queue_worker " Jeff Mahoney
2011-10-25  1:03 ` [patch 30/66] btrfs: run_ordered_completions " Jeff Mahoney
2011-10-25  1:03 ` [patch 31/66] btrfs: btrfs_stop_workers " Jeff Mahoney
2011-10-25  1:03 ` [patch 32/66] btrfs: btrfs_requeue_work " Jeff Mahoney
2011-10-25  1:03 ` [patch 33/66] btrfs: tree-log: btrfs_end_log_trans " Jeff Mahoney
2011-10-25  1:03 ` [patch 34/66] btrfs: tree-log: wait_for_writer " Jeff Mahoney
2011-10-25  1:03 ` [patch 35/66] btrfs: btrfs_init_compress " Jeff Mahoney
2011-10-25  1:03 ` [patch 36/66] btrfs: btrfs_invalidate_inodes " Jeff Mahoney
2011-10-25  1:03 ` [patch 37/66] btrfs: __setup_root " Jeff Mahoney
2011-10-25  1:03 ` [patch 38/66] btrfs: btrfs_destroy_delalloc_inodes " Jeff Mahoney
2011-10-25  1:03 ` [patch 39/66] btrfs: btrfs_prepare_extent_commit " Jeff Mahoney
2011-10-25  1:03 ` [patch 40/66] btrfs: btrfs_set_block_group_rw " Jeff Mahoney
2011-10-25  1:03 ` [patch 41/66] btrfs: setup_inline_extent_backref " Jeff Mahoney
2011-10-25  1:03 ` [patch 42/66] btrfs: btrfs_run_defrag_inodes " Jeff Mahoney
2011-10-25  1:03 ` [patch 43/66] btrfs: Simplify btrfs_submit_bio_hook Jeff Mahoney
2011-10-25  1:03 ` [patch 44/66] btrfs: Factor out tree->ops->merge_bio_hook call Jeff Mahoney
2011-10-25  1:03 ` [patch 45/66] btrfs: ->submit_bio_hook error push-up Jeff Mahoney
2011-10-25  1:03 ` [patch 46/66] btrfs: __add_reloc_root " Jeff Mahoney
2011-10-25  1:03 ` [patch 47/66] btrfs: fixup_low_keys should return void Jeff Mahoney
2011-10-25  1:03 ` [patch 48/66] btrfs: setup_items_for_insert " Jeff Mahoney
2011-10-25  1:03 ` [patch 49/66] btrfs: del_ptr " Jeff Mahoney
2011-10-25  1:03 ` [patch 50/66] btrfs: insert_ptr " Jeff Mahoney
2011-10-25  1:03 ` [patch 51/66] btrfs: add_delayed_ref_head " Jeff Mahoney
2011-10-25  1:03 ` [patch 52/66] btrfs: add_delayed_tree_ref " Jeff Mahoney
2011-10-25  1:03 ` [patch 53/66] btrfs: add_delayed_data_ref " Jeff Mahoney
2011-10-25  1:03 ` [patch 54/66] btrfs: Fix kfree of member instead of structure Jeff Mahoney
2011-10-25  1:03 ` [patch 55/66] btrfs: Use mempools for delayed refs Jeff Mahoney
2011-10-25  1:03 ` [patch 56/66] btrfs: Delayed ref mempool functions should return void Jeff Mahoney
2011-10-25  1:03 ` [patch 57/66] btrfs: btrfs_inc_extent_ref void return prep Jeff Mahoney
2011-10-25  1:03 ` [patch 58/66] btrfs: btrfs_free_extent " Jeff Mahoney
2011-10-25  1:03 ` [patch 59/66] btrfs: __btrfs_mod_refs process_func should return void Jeff Mahoney
2011-10-25  1:03 ` [patch 60/66] btrfs: __btrfs_mod_ref " Jeff Mahoney
2011-10-25  1:03 ` [patch 61/66] btrfs: clean_tree_block " Jeff Mahoney
2011-10-25  1:03 ` [patch 62/66] btrfs: btrfs_truncate_item " Jeff Mahoney
2011-10-25  1:03 ` [patch 63/66] btrfs: btrfs_extend_item " Jeff Mahoney
2011-10-25  1:03 ` [patch 64/66] btrfs: end_compressed_writeback " Jeff Mahoney
2011-10-25  1:03 ` [patch 65/66] btrfs: copy_for_split " Jeff Mahoney
2011-10-25  1:03 ` [patch 66/66] btrfs: update_inline_extent_backref " Jeff Mahoney

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=4EA824D2.6070801@suse.com \
    --to=jeffm@suse.com \
    --cc=chris.mason@oracle.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.