Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107415
b: refs/heads/master
c: e48ad31
h: refs/heads/master
i:
  107413: bf42b12
  107411: 93365b2
  107407: ae4163c
v: v3
  • Loading branch information
Christoph Hellwig authored and Niv Sardi committed Jul 28, 2008
1 parent f4b5ca7 commit 1e778f8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 93 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61436febae29085bffc7c291db03cbd709dc68a3
refs/heads/master: e48ad3160e5c5f5b952c7a7ed814f6f289a60100
71 changes: 67 additions & 4 deletions trunk/fs/xfs/linux-2.6/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,14 +1087,61 @@ xfs_fs_put_super(
struct super_block *sb)
{
struct xfs_mount *mp = XFS_M(sb);
struct xfs_inode *rip = mp->m_rootip;
int unmount_event_flags = 0;
int error;

kthread_stop(mp->m_sync_task);

xfs_sync(mp, SYNC_ATTR | SYNC_DELWRI);
error = xfs_unmount(mp, 0, NULL);
if (error)
printk("XFS: unmount got error=%d\n", error);

#ifdef HAVE_DMAPI
if (mp->m_flags & XFS_MOUNT_DMAPI) {
unmount_event_flags =
(mp->m_dmevmask & (1 << DM_EVENT_UNMOUNT)) ?
0 : DM_FLAGS_UNWANTED;
/*
* Ignore error from dmapi here, first unmount is not allowed
* to fail anyway, and second we wouldn't want to fail a
* unmount because of dmapi.
*/
XFS_SEND_PREUNMOUNT(mp, rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL,
NULL, NULL, 0, 0, unmount_event_flags);
}
#endif

/*
* Blow away any referenced inode in the filestreams cache.
* This can and will cause log traffic as inodes go inactive
* here.
*/
xfs_filestream_unmount(mp);

XFS_bflush(mp->m_ddev_targp);
error = xfs_unmount_flush(mp, 0);
WARN_ON(error);

IRELE(rip);

/*
* If we're forcing a shutdown, typically because of a media error,
* we want to make sure we invalidate dirty pages that belong to
* referenced vnodes as well.
*/
if (XFS_FORCED_SHUTDOWN(mp)) {
error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE);
ASSERT(error != EFSCORRUPTED);
}

if (mp->m_flags & XFS_MOUNT_DMAPI) {
XFS_SEND_UNMOUNT(mp, rip, DM_RIGHT_NULL, 0, 0,
unmount_event_flags);
}

xfs_unmountfs(mp, NULL);
xfs_qmops_put(mp);
xfs_dmops_put(mp);
kmem_free(mp);
}

STATIC void
Expand Down Expand Up @@ -1400,7 +1447,23 @@ xfs_fs_fill_super(
}

fail_unmount:
xfs_unmount(mp, 0, NULL);
/*
* Blow away any referenced inode in the filestreams cache.
* This can and will cause log traffic as inodes go inactive
* here.
*/
xfs_filestream_unmount(mp);

XFS_bflush(mp->m_ddev_targp);
error = xfs_unmount_flush(mp, 0);
WARN_ON(error);

IRELE(mp->m_rootip);

xfs_unmountfs(mp, NULL);
xfs_qmops_put(mp);
xfs_dmops_put(mp);
kmem_free(mp);

fail_vfsop:
kmem_free(args);
Expand Down
87 changes: 0 additions & 87 deletions trunk/fs/xfs/xfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,93 +558,6 @@ xfs_mount(
return error;
}

int
xfs_unmount(
xfs_mount_t *mp,
int flags,
cred_t *credp)
{
xfs_inode_t *rip;
bhv_vnode_t *rvp;
int unmount_event_wanted = 0;
int unmount_event_flags = 0;
int xfs_unmountfs_needed = 0;
int error;

rip = mp->m_rootip;
rvp = XFS_ITOV(rip);

#ifdef HAVE_DMAPI
if (mp->m_flags & XFS_MOUNT_DMAPI) {
error = XFS_SEND_PREUNMOUNT(mp,
rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL,
NULL, NULL, 0, 0,
(mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))?
0:DM_FLAGS_UNWANTED);
if (error)
return XFS_ERROR(error);
unmount_event_wanted = 1;
unmount_event_flags = (mp->m_dmevmask & (1<<DM_EVENT_UNMOUNT))?
0 : DM_FLAGS_UNWANTED;
}
#endif

/*
* Blow away any referenced inode in the filestreams cache.
* This can and will cause log traffic as inodes go inactive
* here.
*/
xfs_filestream_unmount(mp);

XFS_bflush(mp->m_ddev_targp);
error = xfs_unmount_flush(mp, 0);
if (error)
goto out;

ASSERT(vn_count(rvp) == 1);

/*
* Drop the reference count
*/
IRELE(rip);

/*
* If we're forcing a shutdown, typically because of a media error,
* we want to make sure we invalidate dirty pages that belong to
* referenced vnodes as well.
*/
if (XFS_FORCED_SHUTDOWN(mp)) {
error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE);
ASSERT(error != EFSCORRUPTED);
}
xfs_unmountfs_needed = 1;

out:
/* Send DMAPI event, if required.
* Then do xfs_unmountfs() if needed.
* Then return error (or zero).
*/
if (unmount_event_wanted) {
/* Note: mp structure must still exist for
* XFS_SEND_UNMOUNT() call.
*/
XFS_SEND_UNMOUNT(mp, error == 0 ? rip : NULL,
DM_RIGHT_NULL, 0, error, unmount_event_flags);
}
if (xfs_unmountfs_needed) {
/*
* Call common unmount function to flush to disk
* and free the super block buffer & mount structures.
*/
xfs_unmountfs(mp, credp);
xfs_qmops_put(mp);
xfs_dmops_put(mp);
kmem_free(mp);
}

return XFS_ERROR(error);
}

STATIC void
xfs_quiesce_fs(
xfs_mount_t *mp)
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/xfs/xfs_vfsops.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct xfs_mount_args;

int xfs_mount(struct xfs_mount *mp, struct xfs_mount_args *args,
struct cred *credp);
int xfs_unmount(struct xfs_mount *mp, int flags, struct cred *credp);
int xfs_sync(struct xfs_mount *mp, int flags);
void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
int lnnum);
Expand Down

0 comments on commit 1e778f8

Please sign in to comment.