]> granicus.if.org Git - zfs/commitdiff
Linux 4.12 compat: fix super_setup_bdi_name() call
authorLOLi <loli10K@users.noreply.github.com>
Thu, 25 May 2017 16:55:55 +0000 (18:55 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 25 May 2017 16:55:55 +0000 (09:55 -0700)
Provide a format parameter to super_setup_bdi_name() so we don't
create duplicate names in '/devices/virtual/bdi' sysfs namespace which
would prevent us from mounting more than one ZFS filesystem at a time.

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6147

include/linux/vfs_compat.h
module/zfs/zfs_vfsops.c

index 0085aa850394804382b0a9b9ea7e0dcdb9018be0..6111f0afca1d86332900654b78f836267abb17f3 100644 (file)
@@ -74,10 +74,13 @@ truncate_setsize(struct inode *ip, loff_t new)
  * 4.12 - x.y, super_setup_bdi_name() new interface.
  */
 #if defined(HAVE_SUPER_SETUP_BDI_NAME)
+extern atomic_long_t zfs_bdi_seq;
+
 static inline int
 zpl_bdi_setup(struct super_block *sb, char *name)
 {
-       return (super_setup_bdi_name(sb, name));
+       return super_setup_bdi_name(sb, "%.28s-%ld", name,
+           atomic_long_inc_return(&zfs_bdi_seq));
 }
 static inline void
 zpl_bdi_destroy(struct super_block *sb)
@@ -144,7 +147,6 @@ static inline int
 zpl_bdi_setup(struct super_block *sb, char *name)
 {
        struct backing_dev_info *bdi;
-       char tmp[32];
        int error;
 
        bdi = kmem_zalloc(sizeof (struct backing_dev_info), KM_SLEEP);
@@ -157,8 +159,7 @@ zpl_bdi_setup(struct super_block *sb, char *name)
                return (error);
        }
 
-       sprintf(tmp, "%.28s%s", name, "-%d");
-       error = bdi_register(bdi, NULL, tmp,
+       error = bdi_register(bdi, NULL, "%.28s-%ld", name,
            atomic_long_inc_return(&zfs_bdi_seq));
        if (error) {
                bdi_destroy(bdi);
index 15cadcad5123096de2d1673e49daa1a0d56641b1..6d4761607b20c334f1bde10811e37f0519f0862b 100644 (file)
@@ -1568,8 +1568,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
        return (0);
 }
 
-#if !defined(HAVE_SUPER_SETUP_BDI_NAME) && \
-       !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
+#if !defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) && \
        !defined(HAVE_3ARGS_BDI_SETUP_AND_REGISTER)
 atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0);
 #endif