Skip to contentSkip to conversation

f2fs: fix compress file start atomic write may cause data corruption

RFC PATCH In review Fengnan Chang 3 participants 7 messages Mar 5, 2022 – Mar 10, 2022 F2FS file system

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 f2fs: fix compress file start atomic write may cause data corruption

When compressed file has blocks, start atomic write will be failed, but still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite whole cluster)
---
 fs/f2fs/data.c | 4 +---
 fs/f2fs/file.c | 3 ++-
 2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c +1 -2
index 6b5f389ba998..5cbee4ed0982 100644
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
 		int ret;
 
 		*fsdata = NULL;
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
 			goto repeat;
 
 		ret = f2fs_prepare_compress_overwrite(inode, pagep,
fs/f2fs/file.c +2 -1
index cfdc41f87f5d..26a648ef9e1f 100644
@@ -2009,7 +2009,8 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
 
 	inode_lock(inode);
 
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
 	if (f2fs_is_atomic_file(inode)) {
 		if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST))
Signature · 9 lines
2.25.1

git send-email --to [email protected] --to [email protected] --cc [email protected] --cc [email protected] --rfc 0001-f2fs-fix-compress-file-start-atomic-write-may-cause-.patch


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#1 lore raw
Quoted 1 line · Fengnan Chang

When compressed file has blocks, start atomic write will be failed, but

You mean f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode?

Quoted 2 lines

still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Could you please explain more about why data will be corrupted?

Thanks,

Quoted 28 lines
Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite whole cluster)
---
  fs/f2fs/data.c | 4 +---
  fs/f2fs/file.c | 3 ++-
  2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c +1 -2
index 6b5f389ba998..5cbee4ed0982 100644
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
  		int ret;
 
  		*fsdata = NULL;
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
  			goto repeat;
 
  		ret = f2fs_prepare_compress_overwrite(inode, pagep,
fs/f2fs/file.c +0 -0
index cfdc41f87f5d..26a648ef9e1f 100644

fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp) · line 2016

Quoted 9 lines
fs/f2fs/file.c +2 -1
@@ -2009,7 +2009,8 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
 
  	inode_lock(inode);
 
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
  	if (f2fs_is_atomic_file(inode)) {
  		if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
Quoted 10 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 9:43 AM
To: Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]; 常凤楠 <[email protected]>
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 6 lines
Quoted 2 lines · Fengnan Chang

When compressed file has blocks, start atomic write will be failed, but

You mean f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode?

Yes.

Quoted 5 lines
Quoted 3 lines

still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Could you please explain more about why data will be corrupted?

Step 1:
Create a compressed file ,write 64K data , call fsync(), then the blocks are write as compressed cluster. Step2:
iotcl(F2FS_IOC_START_ATOMIC_WRITE) --- this should be fail, but not.
write page 0 and page 3.
iotcl(F2FS_IOC_COMMIT_ATOMIC_WRITE) -- page 0 and 3 write as normal file,
Step3:
drop cache.
Read page 0-4 -- Since page 0 has a valid block address, read as no-compressed, page 1 and 2 will be compressed data or zero.

And before f2fs: compress: remove unneeded read when rewrite whole cluster), even Step 2 is not right, but whole cluster will mark dirty in write_begin, and whole cluster will be re-write as no-compressed cluster, so it's ok.

Quoted 35 lines

Thanks,

fs/f2fs/data.c static int f2fs_write_begin(struct file *file, struct

Quoted 15 lines
Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite

whole cluster)

---
  fs/f2fs/data.c | 4 +---
  fs/f2fs/file.c | 3 ++-
  2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

6b5f389ba998..5cbee4ed0982 100644

fs/f2fs/data.c +0 -0
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file *file, struct

address_space *mapping,

Quoted 16 lines
fs/f2fs/data.c +1 -2
  		int ret;
 
  		*fsdata = NULL;
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
  			goto repeat;
 
  		ret = f2fs_prepare_compress_overwrite(inode, pagep, diff --git

a/fs/f2fs/file.c b/fs/f2fs/file.c index cfdc41f87f5d..26a648ef9e1f 100644

fs/f2fs/file.c +0 -0
@@ -2009,7 +2009,8 @@ static int f2fs_ioc_start_atomic_write(struct
 file *filp)
 
Quoted 8 lines
Quoted 8 lines
fs/f2fs/file.c +2 -1
  	inode_lock(inode);
 
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
  	if (f2fs_is_atomic_file(inode)) {

if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#3 lore raw
Quoted 35 lines · 常凤楠
Quoted 10 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 9:43 AM
To: Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]; 常凤楠 <[email protected]>
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 6 lines
Quoted 2 lines · Fengnan Chang

When compressed file has blocks, start atomic write will be failed, but

You mean f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode?

Yes.

Quoted 5 lines
Quoted 3 lines

still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Could you please explain more about why data will be corrupted?

Step 1:
Create a compressed file ,write 64K data , call fsync(), then the blocks are write as compressed cluster. Step2:
iotcl(F2FS_IOC_START_ATOMIC_WRITE) --- this should be fail, but not.
write page 0 and page 3.
iotcl(F2FS_IOC_COMMIT_ATOMIC_WRITE) -- page 0 and 3 write as normal file,
Step3:
drop cache.
Read page 0-4 -- Since page 0 has a valid block address, read as no-compressed, page 1 and 2 will be compressed data or zero.

Quoted 2 lines

And before f2fs: compress: remove unneeded read when rewrite whole cluster), even Step 2 is not right, but whole cluster will mark dirty in write_begin, and whole cluster will be re-write as no-compressed cluster, so it's ok.

Ah, after 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite whole cluster), we expect that f2fs_write_cache_pages() will be called, and f2fs_prepare_compress_overwrite() can read and set dirty left pages of compressed cluster.

However atomic commit flow won't call f2fs_write_cache_pages()...

Anyway, thanks for the explanation, and, could you please add above comments into commit description of this patch?

Thanks,

Quoted 36 lines
Quoted 36 lines

Thanks,

fs/f2fs/data.c static int f2fs_write_begin(struct file *file, struct

Quoted 15 lines
Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite

whole cluster)

---
   fs/f2fs/data.c | 4 +---
   fs/f2fs/file.c | 3 ++-
   2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

6b5f389ba998..5cbee4ed0982 100644

fs/f2fs/data.c +0 -0
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file *file, struct

address_space *mapping,

Quoted 16 lines
fs/f2fs/data.c +1 -2
   		int ret;
 
   		*fsdata = NULL;
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
   			goto repeat;
 
   		ret = f2fs_prepare_compress_overwrite(inode, pagep, diff --git

a/fs/f2fs/file.c b/fs/f2fs/file.c index cfdc41f87f5d..26a648ef9e1f 100644

fs/f2fs/file.c +0 -0
@@ -2009,7 +2009,8 @@ static int f2fs_ioc_start_atomic_write(struct
 file *filp)
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/file.c +2 -1
   	inode_lock(inode);
 
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
   	if (f2fs_is_atomic_file(inode)) {

if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#4 lore raw
Quoted 58 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 6:30 PM
To: 常凤楠 <[email protected]>; Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 20 lines · 常凤楠
Quoted 10 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 9:43 AM
To: Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]; 常凤楠 <[email protected]>
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 6 lines
Quoted 2 lines · Fengnan Chang

When compressed file has blocks, start atomic write will be failed, but

You mean f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode?

Yes.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Could you please explain more about why data will be corrupted?

Step 1:
Create a compressed file ,write 64K data , call fsync(), then the blocks are

write as compressed cluster.

Quoted 8 lines

Step2:
iotcl(F2FS_IOC_START_ATOMIC_WRITE) --- this should be fail, but not. write page 0 and page 3. iotcl(F2FS_IOC_COMMIT_ATOMIC_WRITE) -- page 0 and 3 write as normal file,
Step3:
drop cache.
Read page 0-4 -- Since page 0 has a valid block address, read as

no-compressed, page 1 and 2 will be compressed data or zero.

Quoted 3 lines

And before f2fs: compress: remove unneeded read when rewrite whole cluster), even Step 2 is not right, but whole cluster will mark dirty in

write_begin, and whole cluster will be re-write as no-compressed cluster, so it's ok.

Ah, after 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite whole cluster), we expect that f2fs_write_cache_pages() will be called, and f2fs_prepare_compress_overwrite() can read and set dirty left pages of compressed cluster.

Quoted 4 lines

However atomic commit flow won't call f2fs_write_cache_pages()...

Anyway, thanks for the explanation, and, could you please add above comments into commit description of this patch?

Yes, I'll add more comments in next version.
And I want to know why atomic write need disable compressed file, I didn't see any special is incompatible with compression.

Thanks.

Quoted 40 lines

Thanks,

Quoted 37 lines
Quoted 37 lines

Thanks,

Quoted 15 lines
Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when

rewrite whole cluster)

---
   fs/f2fs/data.c | 4 +---
   fs/f2fs/file.c | 3 ++-
   2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

6b5f389ba998..5cbee4ed0982 100644

fs/f2fs/data.c +0 -0
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file *file,
Quoted 1 line

struct

address_space *mapping,

Quoted 16 lines
   		int ret;

   		*fsdata = NULL;
fs/f2fs/data.c +1 -2
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
   			goto repeat;
 
   		ret = f2fs_prepare_compress_overwrite(inode, pagep, diff --git

a/fs/f2fs/file.c b/fs/f2fs/file.c index cfdc41f87f5d..26a648ef9e1f 100644

fs/f2fs/file.c +0 -0
@@ -2009,7 +2009,8 @@ static int f2fs_ioc_start_atomic_write(struct
 file *filp)
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/file.c +2 -1
   	inode_lock(inode);
 
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
   	if (f2fs_is_atomic_file(inode)) {

if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#5 lore raw
Quoted 58 lines · 常凤楠
Quoted 58 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 6:30 PM
To: 常凤楠 <[email protected]>; Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 20 lines · 常凤楠
Quoted 10 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 9:43 AM
To: Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]; 常凤楠 <[email protected]>
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 6 lines
Quoted 2 lines · Fengnan Chang

When compressed file has blocks, start atomic write will be failed, but

You mean f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode?

Yes.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Could you please explain more about why data will be corrupted?

Step 1:
Create a compressed file ,write 64K data , call fsync(), then the blocks are

write as compressed cluster.

Quoted 8 lines

Step2:
iotcl(F2FS_IOC_START_ATOMIC_WRITE) --- this should be fail, but not. write page 0 and page 3. iotcl(F2FS_IOC_COMMIT_ATOMIC_WRITE) -- page 0 and 3 write as normal file,
Step3:
drop cache.
Read page 0-4 -- Since page 0 has a valid block address, read as

no-compressed, page 1 and 2 will be compressed data or zero.

Quoted 3 lines

And before f2fs: compress: remove unneeded read when rewrite whole cluster), even Step 2 is not right, but whole cluster will mark dirty in

write_begin, and whole cluster will be re-write as no-compressed cluster, so it's ok.

Ah, after 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite whole cluster), we expect that f2fs_write_cache_pages() will be called, and f2fs_prepare_compress_overwrite() can read and set dirty left pages of compressed cluster.

Quoted 7 lines
Quoted 4 lines

However atomic commit flow won't call f2fs_write_cache_pages()...

Anyway, thanks for the explanation, and, could you please add above comments into commit description of this patch?

Yes, I'll add more comments in next version.
And I want to know why atomic write need disable compressed file, I didn't see any special is incompatible with compression.

I guess there is no incompatibility issue, however, as most database file will be updated frequently, write amplification due to compression cluster design may hurt database update performance, any particular scenario of using compressed db file?

Thanks,

Quoted 42 lines

Thanks.

Quoted 40 lines

Thanks,

Quoted 37 lines
Quoted 37 lines

Thanks,

Quoted 15 lines
Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when

rewrite whole cluster)

---
    fs/f2fs/data.c | 4 +---
    fs/f2fs/file.c | 3 ++-
    2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

6b5f389ba998..5cbee4ed0982 100644

fs/f2fs/data.c +0 -0
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file *file,
Quoted 1 line

struct

address_space *mapping,

Quoted 16 lines
    		int ret;

    		*fsdata = NULL;
fs/f2fs/data.c +1 -2
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
    			goto repeat;
 
    		ret = f2fs_prepare_compress_overwrite(inode, pagep, diff --git

a/fs/f2fs/file.c b/fs/f2fs/file.c index cfdc41f87f5d..26a648ef9e1f 100644

fs/f2fs/file.c +0 -0
@@ -2009,7 +2009,8 @@ static int f2fs_ioc_start_atomic_write(struct
 file *filp)
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/file.c +2 -1
    	inode_lock(inode);
 
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
    	if (f2fs_is_atomic_file(inode)) {

if (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#6 lore raw
Quoted 79 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Wednesday, March 9, 2022 11:33 AM
To: 常凤楠 <[email protected]>; Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 35 lines · 常凤楠
Quoted 35 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 6:30 PM
To: 常凤楠 <[email protected]>; Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 25 lines · 常凤楠
Quoted 10 lines

-----Original Message-----
From: Chao Yu <[email protected]>
Sent: Monday, March 7, 2022 9:43 AM
To: Fengnan Chang <[email protected]>; [email protected]
Cc: [email protected]; 常凤楠 <[email protected]>
Subject: Re: [RFC PATCH] f2fs: fix compress file start atomic write may cause data corruption

Quoted 6 lines
Quoted 2 lines · Fengnan Chang

When compressed file has blocks, start atomic write will be failed, but

You mean f2fs_ioc_start_atomic_write will succeed, but compressed flag will be remained in inode?

Yes.

Quoted 5 lines
Quoted 3 lines

still set FI_ATOMIC_FILE flag, if write partial cluster and commit atomic write will cause data corruption.

Could you please explain more about why data will be corrupted?

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Step 1:
Create a compressed file ,write 64K data , call fsync(), then the blocks are

write as compressed cluster.

Quoted 4 lines

Step2:
iotcl(F2FS_IOC_START_ATOMIC_WRITE) --- this should be fail, but not. write page 0 and page 3. iotcl(F2FS_IOC_COMMIT_ATOMIC_WRITE) -- page 0 and 3 write as

normal

Quoted 23 lines
Quoted 22 lines
Quoted 4 lines

file,
Step3:
drop cache.
Read page 0-4 -- Since page 0 has a valid block address, read as

no-compressed, page 1 and 2 will be compressed data or zero.

Quoted 4 lines

And before f2fs: compress: remove unneeded read when rewrite whole cluster), even Step 2 is not right, but whole cluster will mark dirty in

write_begin, and whole cluster will be re-write as no-compressed cluster, so it's ok.

Ah, after 7eab7a696827 (f2fs: compress: remove unneeded read when rewrite whole cluster), we expect that f2fs_write_cache_pages() will be called, and
f2fs_prepare_compress_overwrite() can read and set dirty left pages of compressed cluster.

However atomic commit flow won't call f2fs_write_cache_pages()...

Anyway, thanks for the explanation, and, could you please add above comments into commit description of this patch?

Quoted 8 lines
Quoted 2 lines

Yes, I'll add more comments in next version.
And I want to know why atomic write need disable compressed file, I didn't

see any special is incompatible with compression.

I guess there is no incompatibility issue, however, as most database file will be updated frequently, write amplification due to compression cluster design may hurt database update performance, any particular scenario of using compressed db file?

There is particular scenario of using compressed db file, just out of curiosity.

Quoted 49 lines

Thanks,

Quoted 46 lines

Thanks.

Quoted 44 lines

Thanks,

Quoted 41 lines
Quoted 41 lines

Thanks,

Quoted 15 lines
Fixes 4c8ff7095bef (f2fs: support data compression)
Fixes 7eab7a696827 (f2fs: compress: remove unneeded read when

rewrite whole cluster)

---
    fs/f2fs/data.c | 4 +---
    fs/f2fs/file.c | 3 ++-
    2 files changed, 3 insertions(+), 4 deletions(-)
fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

6b5f389ba998..5cbee4ed0982 100644

fs/f2fs/data.c static int f2fs_write_begin(struct file · line 3358

Quoted 1 line
fs/f2fs/data.c +0 -0
@@ -3358,8 +3358,7 @@ static int f2fs_write_begin(struct file
 *file, struct

address_space *mapping,

Quoted 20 lines
fs/f2fs/data.c +1 -2
    		int ret;
 
    		*fsdata = NULL;
-
-		if (len == PAGE_SIZE)
+		if (len == PAGE_SIZE && !(f2fs_is_atomic_file(inode)))
    			goto repeat;
 

ret = f2fs_prepare_compress_overwrite(inode, pagep, diff
--git a/fs/f2fs/file.c b/fs/f2fs/file.c index cfdc41f87f5d..26a648ef9e1f
100644

fs/f2fs/file.c +0 -0
@@ -2009,7 +2009,8 @@ static int

f2fs_ioc_start_atomic_write(struct
file *filp)

    	inode_lock(inode);
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

fs/f2fs/file.c static int f2fs_ioc_start_atomic_write(struct file *filp)

Quoted 6 lines
fs/f2fs/file.c +2 -1
-	f2fs_disable_compressed_file(inode);
+	if (!f2fs_disable_compressed_file(inode))
+		return -EINVAL;
 
    	if (f2fs_is_atomic_file(inode)) {
    		if (is_inode_flag_set(inode,

FI_ATOMIC_REVOKE_REQUEST))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel