All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 2/2] ocfs2: fix check condition of max inline data
Date: Wed, 04 Mar 2009 11:43:31 +0800	[thread overview]
Message-ID: <49ADF8E3.8030605@oracle.com> (raw)
In-Reply-To: <1236136898-3999-1-git-send-email-tiger.yang@oracle.com>

Hi tiger,
	I just searched the code in ocfs2. There are other cases(in 
ocfs2_read_inline_data) which may have the problem also.

So I just think that since you have already added inlin-data-xattr 
support in ocfs2, why not remove the function ocfs2_max_inline_data and 
use ocfs2_max_inline_data_with_xattr instead in all the cases?  Make it 
more intelligent?

I am just worried that this function may be used wrongly afterwards and 
cause future bugs like this.

Regards,
Tao

Tiger Yang wrote:
> We should consider the inline xattr when
> we try to write inline data.
> 
> Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
> ---
>  fs/ocfs2/aops.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index a067a6c..dc6d734 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -1555,6 +1555,7 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
>  	int ret, written = 0;
>  	loff_t end = pos + len;
>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
> +	struct ocfs2_dinode *di = NULL;
>  
>  	mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
>  	     (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
> @@ -1587,7 +1588,9 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping,
>  	/*
>  	 * Check whether the write can fit.
>  	 */
> -	if (mmap_page || end > ocfs2_max_inline_data(inode->i_sb))
> +	di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
> +	if (mmap_page ||
> +	    end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di))
>  		return 0;
>  
>  do_inline_write:

  reply	other threads:[~2009-03-04  3:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04  3:18 [Ocfs2-devel] [PATCH 0/2] ocfs2: two bug fixes about xattr and inline-data Tiger Yang
2009-03-04  3:21 ` [Ocfs2-devel] [PATCH 1/2] ocfs2: reserve xattr block for directory inode in mknod Tiger Yang
2009-03-05  1:37   ` Joel Becker
2009-03-04  3:21 ` [Ocfs2-devel] [PATCH 2/2] ocfs2: fix check condition of max inline data Tiger Yang
2009-03-04  3:43   ` Tao Ma [this message]
2009-03-04  5:47     ` Tiger Yang
2009-03-04  5:49       ` Tao Ma
2009-03-05  1:44         ` Joel Becker
2009-03-05  2:36 ` [Ocfs2-devel] [PATCH 0/2] ocfs2: two bug fixes about xattr and inline-data Joel Becker
2009-03-09  4:17   ` tristan.ye
2009-03-09  4:57     ` Tao Ma
2009-03-09  5:04       ` tristan.ye
2009-03-09  5:42         ` Tao Ma
2009-03-09  6:14           ` tristan.ye
2009-03-09  6:35             ` Tiger Yang
2009-03-09  6:47               ` Joel Becker
2009-03-09  6:54                 ` tristan.ye
2009-03-09  7:02                   ` Tao Ma
2009-03-09  7:24                     ` Tiger Yang
2009-03-09 10:36                       ` Tiger Yang
2009-03-09 10:39                         ` Wengang Wang
2009-03-09 10:48                           ` Tao Ma
2009-03-09 10:57                         ` tristan.ye
2009-03-09  6:28   ` tristan.ye

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=49ADF8E3.8030605@oracle.com \
    --to=tao.ma@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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.