Re: [f2fs-dev] [PATCH] f2fs: check mount option before turn quota on

2018-06-06 Thread Chao Yu
On 2018/6/6 10:12, Yunlei He wrote:
> This patch add a mount option check before turn quota on,
> which is same as ext4 does. BTW, both f2fs and ext4 have
> no mount options check to enable limits quota on sys file,
> is there no need to do this?
> 
> Signed-off-by: Yunlei He 
> ---
>  fs/f2fs/super.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 25863cec..a0264a5 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1792,6 +1792,9 @@ static int f2fs_quota_on(struct super_block *sb, int 
> type, int format_id,
>   struct inode *inode;
>   int err;
>  
> + if (!test_opt(sb, QUOTA))

s/sb/F2FS_SB(sb)...

Anyway, this fails tests/generic/082, could you look into the issue.

Thanks,

> + return -EINVAL;
> +
>   err = f2fs_quota_sync(sb, type);
>   if (err)
>   return err;
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] fsck.f2fs: do not print content beyond sb->version

2018-06-06 Thread Junling Zheng
Currently, versions in f2fs_configuration have one more byte than
those in sb, so versions in sb may not end with '\0', and then
print_raw_sb_info() will print something beyond sb->version.

Signed-off-by: Junling Zheng 
---
 fsck/mount.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index 0a30adb..9def919 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -341,7 +341,10 @@ void print_raw_sb_info(struct f2fs_super_block *sb)
DISP_u32(sb, node_ino);
DISP_u32(sb, meta_ino);
DISP_u32(sb, cp_payload);
-   DISP("%s", sb, version);
+   if (sb->version[255] != '\0')
+   DISP("%-.256s", sb, version);
+   else
+   DISP("%s", sb, version);
printf("\n");
 }
 
-- 
2.17.0


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] fsck.f2fs: do not print content beyond sb->version

2018-06-06 Thread Junling Zheng
Actually, I prefer to fix this bug by unifying the length of versions in
f2fs_configuration and f2fs_super_block :)

Reference: https://sourceforge.net/p/linux-f2fs/mailman/message/35398537/

Thanks

On 2018/6/6 22:39, Junling Zheng wrote:
> Currently, versions in f2fs_configuration have one more byte than
> those in sb, so versions in sb may not end with '\0', and then
> print_raw_sb_info() will print something beyond sb->version.
> 
> Signed-off-by: Junling Zheng 
> ---
>  fsck/mount.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fsck/mount.c b/fsck/mount.c
> index 0a30adb..9def919 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -341,7 +341,10 @@ void print_raw_sb_info(struct f2fs_super_block *sb)
>   DISP_u32(sb, node_ino);
>   DISP_u32(sb, meta_ino);
>   DISP_u32(sb, cp_payload);
> - DISP("%s", sb, version);
> + if (sb->version[255] != '\0')
> + DISP("%-.256s", sb, version);
> + else
> + DISP("%s", sb, version);
>   printf("\n");
>  }
>  
> 



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 2/2] f2fs: move s_res{u, g}id initialization to default_options()

2018-06-06 Thread Chao Yu
From: Chao Yu 

Let default_options() initialize s_res{u,g}id with default value like
other options.

Signed-off-by: Chao Yu 
---
 fs/f2fs/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 73d7d7e51a61..56f3af86f62c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1355,6 +1355,8 @@ static void default_options(struct f2fs_sb_info *sbi)
F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_DEFAULT;
F2FS_OPTION(sbi).fsync_mode = FSYNC_MODE_POSIX;
F2FS_OPTION(sbi).test_dummy_encryption = false;
+   F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID);
+   F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID);
sbi->readdir_ra = 1;
 
set_opt(sbi, BG_GC);
@@ -2702,9 +2704,6 @@ static int f2fs_fill_super(struct super_block *sb, void 
*data, int silent)
sb->s_fs_info = sbi;
sbi->raw_super = raw_super;
 
-   F2FS_OPTION(sbi).s_resuid = make_kuid(&init_user_ns, F2FS_DEF_RESUID);
-   F2FS_OPTION(sbi).s_resgid = make_kgid(&init_user_ns, F2FS_DEF_RESGID);
-
/* precompute checksum seed for metadata */
if (f2fs_sb_has_inode_chksum(sb))
sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid,
-- 
2.16.2.17.g38e79b1fd


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 1/2] f2fs: don't acquire orphan ino during recovery

2018-06-06 Thread Chao Yu
From: Chao Yu 

During orphan inode recovery, checkpoint should never succeed due to
SBI_POR_DOING flag, so we don't need acquire orphan ino which only be
used by checkpoint.

Signed-off-by: Chao Yu 
---
 fs/f2fs/checkpoint.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 9f825a5a5c9f..ae0a06a8dec1 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -578,12 +578,7 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, 
nid_t ino)
 {
struct inode *inode;
struct node_info ni;
-   int err = f2fs_acquire_orphan_inode(sbi);
-
-   if (err)
-   goto err_out;
-
-   __add_ino_entry(sbi, ino, 0, ORPHAN_INO);
+   int err;
 
inode = f2fs_iget_retry(sbi->sb, ino);
if (IS_ERR(inode)) {
@@ -613,7 +608,6 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, 
nid_t ino)
err = -EIO;
goto err_out;
}
-   __remove_ino_entry(sbi, ino, ORPHAN_INO);
return 0;
 
 err_out:
-- 
2.16.2.17.g38e79b1fd


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel