mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "slava@dubeyko.com" <slava@dubeyko.com>,
	David Howells <dhowells@redhat.com>
Cc: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	Alex Markuze <amarkuze@redhat.com>, Xiubo Li <xiubli@redhat.com>,
	"brauner@kernel.org" <brauner@kernel.org>,
	"idryomov@gmail.com" <idryomov@gmail.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re:  [PATCH] ceph: Fix incorrect flush end position calculation
Date: Wed, 12 Mar 2025 18:43:08 +0000	[thread overview]
Message-ID: <458de992be8760c387f7a4e55a1e42a021090a02.camel@ibm.com> (raw)
In-Reply-To: <1243044.1741776431@warthog.procyon.org.uk>

On Wed, 2025-03-12 at 10:47 +0000, David Howells wrote:
> In ceph, in fill_fscrypt_truncate(), the end flush position is calculated
> by:
> 
>                 loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SHIFT - 1;
> 
> but that's using the block shift not the block size.
> 
> Fix this to use the block size instead.
> 
> Fixes: 5c64737d2536 ("ceph: add truncate size handling support for fscrypt")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Viacheslav Dubeyko <slava@dubeyko.com>
> cc: Alex Markuze <amarkuze@redhat.com>
> cc: Xiubo Li <xiubli@redhat.com>
> cc: Ilya Dryomov <idryomov@gmail.com>
> cc: ceph-devel@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org
> ---
>  fs/ceph/inode.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index ab63c7ebce5b..ec9b80fec7be 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -2363,7 +2363,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
>  
>  	/* Try to writeback the dirty pagecaches */
>  	if (issued & (CEPH_CAP_FILE_BUFFER)) {
> -		loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SHIFT - 1;
> +		loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SIZE - 1;
>  
>  		ret = filemap_write_and_wait_range(inode->i_mapping,
>  						   orig_pos, lend);
> 
> 

Looks good.

Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>

Do we know easy way to reproduce the issue?

Thanks,
Slava.


  reply	other threads:[~2025-03-12 18:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 10:47 David Howells
2025-03-12 18:43 ` Viacheslav Dubeyko [this message]
2025-03-13  8:25 ` David Howells
2025-03-13  9:00 ` David Howells
2025-03-13 11:26   ` Alex Markuze

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=458de992be8760c387f7a4e55a1e42a021090a02.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=amarkuze@redhat.com \
    --cc=brauner@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    --cc=xiubli@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®