#
# 2.6.38 vfsmount.mnt_count doesn't use atomic_t
#
+# 3.3 starts hiding vfsmount guts series (move from include/linux/mount.h to
+# fs/mount.h, see kernel commit 7d6fec45a5131918b51dcd76da52f2ec86a85be6)
+#
AC_DEFUN([LC_ATOMIC_MNT_COUNT],
-[AC_MSG_CHECKING([if vfsmount.mnt_count is atomic_t])
+[AC_MSG_CHECKING([if vfsmount guts is hidden, or vfsmount.mnt_count is atomic_t.])
LB_LINUX_TRY_COMPILE([
- #include <asm/atomic.h>
- #include <linux/fs.h>
- #include <linux/mount.h>
+ #include <linux/fs.h>
+ #include <../fs/mount.h>
],[
- ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
+ struct mount *mnt = real_mount((struct vfsmount *)0);
],[
- AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
- [vfsmount.mnt_count is atomic_t])
- AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_HIDE_VFSMOUNT_GUTS, 1,
+ [hide vfsmount guts in fs/mount.h])
+ AC_MSG_RESULT([yes, hide vfsmount guts in fs/mount.h])
],[
- AC_MSG_RESULT([no])
+ LB_LINUX_TRY_COMPILE([
+ #include <asm/atomic.h>
+ #include <linux/fs.h>
+ #include <linux/mount.h>
+ ],[
+ ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
+ ],[
+ AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
+ [vfsmount.mnt_count is atomic_t])
+ AC_MSG_RESULT([yes, vfsmount.mnt_count is atomic_t])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
])
])
#include <linux/mpage.h> /* for generic_writepages */
+#ifdef HAVE_HIDE_VFSMOUNT_GUTS
+# include <../fs/mount.h>
+#else
+# define real_mount(mnt) (mnt)
+#endif
+
+static inline const char *mnt_get_devname(struct vfsmount *mnt)
+{
+ return real_mount(mnt)->mnt_devname;
+}
+
#ifndef HAVE_ATOMIC_MNT_COUNT
static inline unsigned int mnt_get_count(struct vfsmount *mnt)
{
#ifdef CONFIG_SMP
- unsigned int count = 0;
- int cpu;
+ unsigned int count = 0;
+ int cpu;
- for_each_possible_cpu(cpu) {
- count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count;
- }
+ for_each_possible_cpu(cpu) {
+ count += per_cpu_ptr(real_mount(mnt)->mnt_pcp, cpu)->mnt_count;
+ }
- return count;
+ return count;
#else
- return mnt->mnt_count;
+ return real_mount(mnt)->mnt_count;
#endif
}
#else
-# define mnt_get_count(mnt) cfs_atomic_read(&mnt->mnt_count)
+# define mnt_get_count(mnt) cfs_atomic_read(&(real_mount(mnt)->mnt_count))
#endif
#ifdef HAVE_STATFS_DENTRY_PARAM
static int lprocfs_mgs_rd_mntdev(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
- struct obd_device* obd = (struct obd_device *)data;
+ struct obd_device *obd = (struct obd_device *)data;
- LASSERT(obd != NULL);
- LASSERT(obd->u.mgs.mgs_vfsmnt->mnt_devname);
- *eof = 1;
+ LASSERT(obd != NULL);
+ LASSERT(mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
+ *eof = 1;
- return snprintf(page, count, "%s\n",obd->u.mgs.mgs_vfsmnt->mnt_devname);
+ return snprintf(page, count, "%s\n",
+ mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
}
static int mgs_fs_seq_show(struct seq_file *seq, void *v)
int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- struct obd_device *obd = (struct obd_device *)data;
+ struct obd_device *obd = (struct obd_device *)data;
- LASSERT(obd != NULL);
- LASSERT(obd->u.obt.obt_vfsmnt->mnt_devname);
- *eof = 1;
- return snprintf(page, count, "%s\n",
- obd->u.obt.obt_vfsmnt->mnt_devname);
+ LASSERT(obd != NULL);
+ LASSERT(mnt_get_devname(obd->u.obt.obt_vfsmnt));
+ *eof = 1;
+ return snprintf(page, count, "%s\n",
+ mnt_get_devname(obd->u.obt.obt_vfsmnt));
}
EXPORT_SYMBOL(lprocfs_obd_rd_mntdev);
(mnt_get_count(mnt) == 1),
cfs_time_seconds(3),
rc);
- cfs_restore_sigs(blocked);
- if (rc < 0) {
- LCONSOLE_EMERG("Danger: interrupted umount %s with "
- "%d refs!\n", mnt->mnt_devname,
- mnt_get_count(mnt));
- break;
- }
-
- }
+ cfs_restore_sigs(blocked);
+ if (rc < 0) {
+ LCONSOLE_EMERG("Danger: interrupted umount %s with "
+ "%d refs!\n", mnt_get_devname(mnt),
+ mnt_get_count(mnt));
+ break;
+ }
+
+ }
}
/** Start the shutdown of servers at umount.
if (unlikely(osd->od_mount == NULL))
return -EINPROGRESS;
- LASSERT(osd->od_mount->lmi_mnt->mnt_devname);
- *eof = 1;
+ LASSERT(mnt_get_devname(osd->od_mount->lmi_mnt));
+ *eof = 1;
- return snprintf(page, count, "%s\n",
- osd->od_mount->lmi_mnt->mnt_devname);
+ return snprintf(page, count, "%s\n",
+ mnt_get_devname(osd->od_mount->lmi_mnt));
}
#ifdef HAVE_LDISKFS_PDO