All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Shishkin <edward.shishkin@gmail.com>
To: Ivan Shapovalov <intelfx100@gmail.com>
Cc: reiserfs-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] reiser4: block_alloc: improve error handling in reiser4_grab_reserved().
Date: Sat, 18 Oct 2014 19:43:47 +0200	[thread overview]
Message-ID: <5442A6D3.4000508@gmail.com> (raw)
In-Reply-To: <1408371283-1319-2-git-send-email-intelfx100@gmail.com>

On 08/18/2014 04:14 PM, Ivan Shapovalov wrote:
> In case of error in reiser4_grab_space(), return the original error code,
> not -ENOSPC unconditionally.
>
> Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
> ---
>   fs/reiser4/block_alloc.c | 35 +++++++++++++++++++----------------
>   1 file changed, 19 insertions(+), 16 deletions(-)
>
> diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
> index 324b11c..7f9f910 100644
> --- a/fs/reiser4/block_alloc.c
> +++ b/fs/reiser4/block_alloc.c
> @@ -360,37 +360,40 @@ int reiser4_grab_reserved(struct super_block *super,
>   			  __u64 count, reiser4_ba_flags_t flags)
>   {
>   	reiser4_super_info_data *sbinfo = get_super_private(super);
> +	int ret;
>   
>   	assert("nikita-3175", flags & BA_CAN_COMMIT);
>   
>   	/* Check the delete mutex already taken by us, we assume that
>   	 * reading of machine word is atomic. */
>   	if (sbinfo->delete_mutex_owner == current) {
> -		if (reiser4_grab_space
> -		    (count, (flags | BA_RESERVED) & ~BA_CAN_COMMIT)) {
> +		ret = reiser4_grab_space (count, (flags | BA_RESERVED) & ~BA_CAN_COMMIT);
> +
> +		if (ret != 0) {
>   			warning("zam-1003",
>   				"nested call of grab_reserved fails count=(%llu)",
>   				(unsigned long long)count);
>   			reiser4_release_reserved(super);
> -			return RETERR(-ENOSPC);
>   		}
> -		return 0;
> -	}
> +	} else {
> +		ret = reiser4_grab_space(count, flags);
>   
> -	if (reiser4_grab_space(count, flags)) {
> -		mutex_lock(&sbinfo->delete_mutex);
> -		assert("nikita-2929", sbinfo->delete_mutex_owner == NULL);
> -		sbinfo->delete_mutex_owner = current;
> +		if (ret != 0) {
> +			mutex_lock(&sbinfo->delete_mutex);
> +			assert("nikita-2929", sbinfo->delete_mutex_owner == NULL);
> +			sbinfo->delete_mutex_owner = current;
> +			ret = reiser4_grab_space(count, flags | BA_RESERVED);
>   
> -		if (reiser4_grab_space(count, flags | BA_RESERVED)) {
> -			warning("zam-833",
> -				"reserved space is not enough (%llu)",
> -				(unsigned long long)count);
> -			reiser4_release_reserved(super);
> -			return RETERR(-ENOSPC);
> +			if (ret != 0) {
> +				warning("zam-833",
> +					"reserved space is not enough (%llu)",
> +					(unsigned long long)count);
> +				reiser4_release_reserved(super);
> +			}
>   		}
>   	}
> -	return 0;
> +
> +	return ret;
>   }
>   
>   void reiser4_release_reserved(struct super_block *super)

OK

  reply	other threads:[~2014-10-18 17:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 14:14 [PATCH 0/3] reiser4: space grabbing fixes Ivan Shapovalov
2014-08-18 14:14 ` [PATCH 1/3] reiser4: block_alloc: improve error handling in reiser4_grab_reserved() Ivan Shapovalov
2014-10-18 17:43   ` Edward Shishkin [this message]
2014-08-18 14:14 ` [PATCH 2/3] reiser4: block_alloc: sanitize grab_enabled modifications Ivan Shapovalov
2014-10-18 17:47   ` Edward Shishkin
2014-10-20  9:43     ` Ivan Shapovalov
2014-11-16  5:39       ` Ivan Shapovalov
2014-08-18 14:14 ` [PATCH 3/3] reiser4: do not mess with grab_enabled; instead, use BA_FORCE Ivan Shapovalov
2014-10-18 17:48   ` Edward Shishkin

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=5442A6D3.4000508@gmail.com \
    --to=edward.shishkin@gmail.com \
    --cc=intelfx100@gmail.com \
    --cc=reiserfs-devel@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.