These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / xfs / xfs_mount.c
index 6f23fbd..bb753b3 100644 (file)
@@ -47,6 +47,16 @@ static DEFINE_MUTEX(xfs_uuid_table_mutex);
 static int xfs_uuid_table_size;
 static uuid_t *xfs_uuid_table;
 
+void
+xfs_uuid_table_free(void)
+{
+       if (xfs_uuid_table_size == 0)
+               return;
+       kmem_free(xfs_uuid_table);
+       xfs_uuid_table = NULL;
+       xfs_uuid_table_size = 0;
+}
+
 /*
  * See if the UUID is unique among mounted XFS filesystems.
  * Mount fails if UUID is nil or a FS with the same UUID is already mounted.
@@ -615,14 +625,14 @@ xfs_default_resblks(xfs_mount_t *mp)
  */
 int
 xfs_mountfs(
-       xfs_mount_t     *mp)
+       struct xfs_mount        *mp)
 {
-       xfs_sb_t        *sbp = &(mp->m_sb);
-       xfs_inode_t     *rip;
-       __uint64_t      resblks;
-       uint            quotamount = 0;
-       uint            quotaflags = 0;
-       int             error = 0;
+       struct xfs_sb           *sbp = &(mp->m_sb);
+       struct xfs_inode        *rip;
+       __uint64_t              resblks;
+       uint                    quotamount = 0;
+       uint                    quotaflags = 0;
+       int                     error = 0;
 
        xfs_sb_mount_common(mp, sbp);
 
@@ -693,10 +703,15 @@ xfs_mountfs(
        if (error)
                goto out;
 
-       error = xfs_uuid_mount(mp);
+       error = xfs_sysfs_init(&mp->m_stats.xs_kobj, &xfs_stats_ktype,
+                              &mp->m_kobj, "stats");
        if (error)
                goto out_remove_sysfs;
 
+       error = xfs_uuid_mount(mp);
+       if (error)
+               goto out_del_stats;
+
        /*
         * Set the minimum read and write sizes
         */
@@ -724,6 +739,22 @@ xfs_mountfs(
                        mp->m_inode_cluster_size = new_size;
        }
 
+       /*
+        * If enabled, sparse inode chunk alignment is expected to match the
+        * cluster size. Full inode chunk alignment must match the chunk size,
+        * but that is checked on sb read verification...
+        */
+       if (xfs_sb_version_hassparseinodes(&mp->m_sb) &&
+           mp->m_sb.sb_spino_align !=
+                       XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size)) {
+               xfs_warn(mp,
+       "Sparse inode block alignment (%u) must match cluster size (%llu).",
+                        mp->m_sb.sb_spino_align,
+                        XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size));
+               error = -EINVAL;
+               goto out_remove_uuid;
+       }
+
        /*
         * Set inode alignment fields
         */
@@ -783,7 +814,9 @@ xfs_mountfs(
        }
 
        /*
-        * log's mount-time initialization. Perform 1st part recovery if needed
+        * Log's mount-time initialization. The first part of recovery can place
+        * some items on the AIL, to be handled when recovery is finished or
+        * cancelled.
         */
        error = xfs_log_mount(mp, mp->m_logdev_targp,
                              XFS_FSB_TO_DADDR(mp, sbp->sb_logstart),
@@ -894,9 +927,9 @@ xfs_mountfs(
        }
 
        /*
-        * Finish recovering the file system.  This part needed to be
-        * delayed until after the root and real-time bitmap inodes
-        * were consistently read in.
+        * Finish recovering the file system.  This part needed to be delayed
+        * until after the root and real-time bitmap inodes were consistently
+        * read in.
         */
        error = xfs_log_mount_finish(mp);
        if (error) {
@@ -939,8 +972,10 @@ xfs_mountfs(
        xfs_rtunmount_inodes(mp);
  out_rele_rip:
        IRELE(rip);
+       cancel_delayed_work_sync(&mp->m_reclaim_work);
+       xfs_reclaim_inodes(mp, SYNC_WAIT);
  out_log_dealloc:
-       xfs_log_unmount(mp);
+       xfs_log_mount_cancel(mp);
  out_fail_wait:
        if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp)
                xfs_wait_buftarg(mp->m_logdev_targp);
@@ -951,6 +986,8 @@ xfs_mountfs(
        xfs_da_unmount(mp);
  out_remove_uuid:
        xfs_uuid_unmount(mp);
+ out_del_stats:
+       xfs_sysfs_del(&mp->m_stats.xs_kobj);
  out_remove_sysfs:
        xfs_sysfs_del(&mp->m_kobj);
  out:
@@ -1027,6 +1064,7 @@ xfs_unmountfs(
                xfs_warn(mp, "Unable to update superblock counters. "
                                "Freespace may not be correct on next mount.");
 
+
        xfs_log_unmount(mp);
        xfs_da_unmount(mp);
        xfs_uuid_unmount(mp);
@@ -1036,6 +1074,7 @@ xfs_unmountfs(
 #endif
        xfs_free_perag(mp);
 
+       xfs_sysfs_del(&mp->m_stats.xs_kobj);
        xfs_sysfs_del(&mp->m_kobj);
 }