]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - fs/f2fs/super.c
f2fs: fix to detect cp error in f2fs_setxattr()
[mirror_ubuntu-hirsute-kernel.git] / fs / f2fs / super.c
index 78a1b873e48ade9259c2592bd263fb86f22fdf16..2d2c91c7eaddeb5f745c6c9de783f073c626fd16 100644 (file)
@@ -873,7 +873,21 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
 
 static int f2fs_drop_inode(struct inode *inode)
 {
+       struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
        int ret;
+
+       /*
+        * during filesystem shutdown, if checkpoint is disabled,
+        * drop useless meta/node dirty pages.
+        */
+       if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) {
+               if (inode->i_ino == F2FS_NODE_INO(sbi) ||
+                       inode->i_ino == F2FS_META_INO(sbi)) {
+                       trace_f2fs_drop_inode(inode, 1);
+                       return 1;
+               }
+       }
+
        /*
         * This is to avoid a deadlock condition like below.
         * writeback_single_inode(inode)
@@ -1522,6 +1536,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
        bool need_stop_gc = false;
        bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE);
        bool disable_checkpoint = test_opt(sbi, DISABLE_CHECKPOINT);
+       bool no_io_align = !F2FS_IO_ALIGNED(sbi);
        bool checkpoint_changed;
 #ifdef CONFIG_QUOTA
        int i, j;
@@ -1601,6 +1616,12 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
                goto restore_opts;
        }
 
+       if (no_io_align == !!F2FS_IO_ALIGNED(sbi)) {
+               err = -EINVAL;
+               f2fs_warn(sbi, "switch io_bits option is not allowed");
+               goto restore_opts;
+       }
+
        if ((*flags & SB_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
                err = -EINVAL;
                f2fs_warn(sbi, "disabling checkpoint not compatible with read-only");
@@ -3202,7 +3223,7 @@ try_onemore:
        if (err)
                goto free_bio_info;
 
-       if (F2FS_IO_SIZE(sbi) > 1) {
+       if (F2FS_IO_ALIGNED(sbi)) {
                sbi->write_io_dummy =
                        mempool_create_page_pool(2 * (F2FS_IO_SIZE(sbi) - 1), 0);
                if (!sbi->write_io_dummy) {