public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: Theodore Tso <tytso@mit.edu>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	linux-ext4@vger.kernel.org
Subject: Re: ENOSPC error returned too late
Date: Mon, 18 Aug 2008 09:44:53 -0700	[thread overview]
Message-ID: <1219077893.8135.0.camel@mingming-laptop> (raw)
In-Reply-To: <20080818133046.GA8184@mit.edu>


在 2008-08-18一的 09:30 -0400,Theodore Tso写道:
> On Mon, Aug 18, 2008 at 04:21:40PM +0530, Aneesh Kumar K.V wrote:
> > --- a/fs/ext4/balloc.c
> > +++ b/fs/ext4/balloc.c
> > @@ -1628,6 +1628,9 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
> >  		free_blocks =
> >  			percpu_counter_sum_and_set(&sbi->s_freeblocks_counter);
> >  #endif
> > +	if (free_blocks <= root_blocks)
> > +		/* we don't have free space */
> > +		return 0;
> >  	if (free_blocks - root_blocks < nblocks)
> >  		return free_blocks - root_blocks;
> >  	return nblocks;
> 
> Thanks, I'll try it out.  Given that ext4_fsblk_t is an unsigned long
> (BTW, this is one of the reasons why the common coding style guide
> dislikes typedefs; it hides this kind of errors), it's obviously a
> good patch to add regardless of whether it solves are problem, since
> if freeblocks < root_blocks, the following condition is going to do
> the Wrong Thing.
> 

Thanks for catching this Aneesh, agreed.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> 
> 						- Ted
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2008-08-18 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-17 12:53 ENOSPC error returned too late Theodore Ts'o
2008-08-18  9:30 ` Aneesh Kumar K.V
2008-08-18 10:51   ` Aneesh Kumar K.V
2008-08-18 13:30     ` Theodore Tso
2008-08-18 16:44       ` Mingming Cao [this message]

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=1219077893.8135.0.camel@mingming-laptop \
    --to=cmm@us.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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