* [PATCH v2 0/2] ceph: misc fix size truncate for fscrypt
@ 2022-04-11 0:14 xiubli
2022-04-11 0:14 ` [PATCH v2 1/2] ceph: flush small range instead of the whole map for truncate xiubli
2022-04-11 0:14 ` [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating xiubli
0 siblings, 2 replies; 5+ messages in thread
From: xiubli @ 2022-04-11 0:14 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
Hi Jeff,
This series could be squashed into the same previous commit:
e90dc20d37a3 ceph: add truncate size handling support for fscrypt
V2:
- remove the filemap lock related patch.
- fix caps reference leakage
Xiubo Li (2):
ceph: flush small range instead of the whole map for truncate
ceph: fix caps reference leakage for fscrypt size truncating
fs/ceph/inode.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] ceph: flush small range instead of the whole map for truncate
2022-04-11 0:14 [PATCH v2 0/2] ceph: misc fix size truncate for fscrypt xiubli
@ 2022-04-11 0:14 ` xiubli
2022-04-11 0:14 ` [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating xiubli
1 sibling, 0 replies; 5+ messages in thread
From: xiubli @ 2022-04-11 0:14 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
fs/ceph/inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 45ca4e598ef0..a2ff964e332b 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2275,8 +2275,13 @@ static int fill_fscrypt_truncate(struct inode *inode,
ceph_cap_string(issued));
/* Try to writeback the dirty pagecaches */
- if (issued & (CEPH_CAP_FILE_BUFFER))
- filemap_write_and_wait(inode->i_mapping);
+ if (issued & (CEPH_CAP_FILE_BUFFER)) {
+ loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SHIFT - 1;
+ ret = filemap_write_and_wait_range(inode->i_mapping,
+ orig_pos, lend);
+ if (ret < 0)
+ goto out;
+ }
page = __page_cache_alloc(GFP_KERNEL);
if (page == NULL) {
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating
2022-04-11 0:14 [PATCH v2 0/2] ceph: misc fix size truncate for fscrypt xiubli
2022-04-11 0:14 ` [PATCH v2 1/2] ceph: flush small range instead of the whole map for truncate xiubli
@ 2022-04-11 0:14 ` xiubli
2022-04-11 16:30 ` Luís Henriques
1 sibling, 1 reply; 5+ messages in thread
From: xiubli @ 2022-04-11 0:14 UTC (permalink / raw)
To: jlayton; +Cc: idryomov, vshankar, ceph-devel, Xiubo Li
From: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
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 a2ff964e332b..6788a1f88eb6 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2301,7 +2301,6 @@ static int fill_fscrypt_truncate(struct inode *inode,
pos = orig_pos;
ret = __ceph_sync_read(inode, &pos, &iter, &retry_op, &objver);
- ceph_put_cap_refs(ci, got);
if (ret < 0)
goto out;
@@ -2365,6 +2364,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
out:
dout("%s %p size dropping cap refs on %s\n", __func__,
inode, ceph_cap_string(got));
+ ceph_put_cap_refs(ci, got);
kunmap_local(iov.iov_base);
if (page)
__free_pages(page, 0);
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating
2022-04-11 0:14 ` [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating xiubli
@ 2022-04-11 16:30 ` Luís Henriques
2022-04-12 1:02 ` Xiubo Li
0 siblings, 1 reply; 5+ messages in thread
From: Luís Henriques @ 2022-04-11 16:30 UTC (permalink / raw)
To: xiubli; +Cc: jlayton, idryomov, vshankar, ceph-devel
On Mon, Apr 11, 2022 at 08:14:26AM +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> 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 a2ff964e332b..6788a1f88eb6 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -2301,7 +2301,6 @@ static int fill_fscrypt_truncate(struct inode *inode,
>
> pos = orig_pos;
> ret = __ceph_sync_read(inode, &pos, &iter, &retry_op, &objver);
> - ceph_put_cap_refs(ci, got);
> if (ret < 0)
> goto out;
>
> @@ -2365,6 +2364,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
> out:
> dout("%s %p size dropping cap refs on %s\n", __func__,
> inode, ceph_cap_string(got));
> + ceph_put_cap_refs(ci, got);
> kunmap_local(iov.iov_base);
> if (page)
> __free_pages(page, 0);
> --
> 2.27.0
>
If the plan is to squash this into commit "ceph: add truncate size
handling support for fscrypt" it may be worth also fix the
kmap_local_page()/kunmap_local() as the first few 'goto out' jumps
shouldn't be doing the kunmap.
Cheers,
--
Luís
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating
2022-04-11 16:30 ` Luís Henriques
@ 2022-04-12 1:02 ` Xiubo Li
0 siblings, 0 replies; 5+ messages in thread
From: Xiubo Li @ 2022-04-12 1:02 UTC (permalink / raw)
To: Luís Henriques; +Cc: jlayton, idryomov, vshankar, ceph-devel
On 4/12/22 12:30 AM, Luís Henriques wrote:
> On Mon, Apr 11, 2022 at 08:14:26AM +0800, xiubli@redhat.com wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>> 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 a2ff964e332b..6788a1f88eb6 100644
>> --- a/fs/ceph/inode.c
>> +++ b/fs/ceph/inode.c
>> @@ -2301,7 +2301,6 @@ static int fill_fscrypt_truncate(struct inode *inode,
>>
>> pos = orig_pos;
>> ret = __ceph_sync_read(inode, &pos, &iter, &retry_op, &objver);
>> - ceph_put_cap_refs(ci, got);
>> if (ret < 0)
>> goto out;
>>
>> @@ -2365,6 +2364,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
>> out:
>> dout("%s %p size dropping cap refs on %s\n", __func__,
>> inode, ceph_cap_string(got));
>> + ceph_put_cap_refs(ci, got);
>> kunmap_local(iov.iov_base);
>> if (page)
>> __free_pages(page, 0);
>> --
>> 2.27.0
>>
> If the plan is to squash this into commit "ceph: add truncate size
> handling support for fscrypt" it may be worth also fix the
> kmap_local_page()/kunmap_local() as the first few 'goto out' jumps
> shouldn't be doing the kunmap.
Good catch, will fix it in V3.
-- Xiubo
> Cheers,
> --
> Luís
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-12 1:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 0:14 [PATCH v2 0/2] ceph: misc fix size truncate for fscrypt xiubli
2022-04-11 0:14 ` [PATCH v2 1/2] ceph: flush small range instead of the whole map for truncate xiubli
2022-04-11 0:14 ` [PATCH v2 2/2] ceph: fix caps reference leakage for fscrypt size truncating xiubli
2022-04-11 16:30 ` Luís Henriques
2022-04-12 1:02 ` Xiubo Li
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.