From 19a2c39a0104659105f0c15277f758b0733b1bbd Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Tue, 2 Aug 2005 22:48:28 +0000 Subject: [PATCH] * amd/mntfs.c (free_mntfs): don't discard the last reference to an mntfs that had been mounted already. It won't have the MFF_RESTARTED flag on, as it gets turned off after the entry is mounted, but it will have the MFF_RSTKEEP flag on. * amd/autil.c (mf_mounted), amd/restart.c (restart_fake_mntfs): show the mntfs's flags. --- ChangeLog | 10 ++++++++++ NEWS | 1 + amd/autil.c | 4 ++-- amd/mntfs.c | 13 ++++++++++--- amd/restart.c | 6 +++--- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3139909..26bce5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-08-02 Erez Zadok + + * amd/mntfs.c (free_mntfs): don't discard the last reference to an + mntfs that had been mounted already. It won't have the + MFF_RESTARTED flag on, as it gets turned off after the entry is + mounted, but it will have the MFF_RSTKEEP flag on. + + * amd/autil.c (mf_mounted), amd/restart.c (restart_fake_mntfs): + show the mntfs's flags. + 2005-08-01 Erez Zadok * conf/mtab/mtab_linux.c: removed unused code. Cleanup. diff --git a/NEWS b/NEWS index ed2f0b0..dfcb90d 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,7 @@ the same file. * aix4 clean build. * use strlcat/snprintf in a few places for safety. * recover from IP address change of a down NFS server + * don't discard restarted mntfs that was used. *** Notes specific to am-utils version 6.1 diff --git a/amd/autil.c b/amd/autil.c index 7f43af8..d42eac3 100644 --- a/amd/autil.c +++ b/amd/autil.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * - * $Id: autil.c,v 1.52 2005/07/20 03:32:30 ezk Exp $ + * $Id: autil.c,v 1.53 2005/08/02 22:48:28 ezk Exp $ * */ @@ -293,8 +293,8 @@ mf_mounted(mntfs *mf, bool_t call_free_opts) } if (mf->mf_flags & MFF_RESTART) { - dlog("Restarted filesystem %s", mf->mf_mount); mf->mf_flags &= ~MFF_RESTART; + dlog("Restarted filesystem %s, flags 0x%x", mf->mf_mount, mf->mf_flags); } /* diff --git a/amd/mntfs.c b/amd/mntfs.c index dfa9490..021afec 100644 --- a/amd/mntfs.c +++ b/amd/mntfs.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * - * $Id: mntfs.c,v 1.36 2005/01/18 03:01:24 ib42 Exp $ + * $Id: mntfs.c,v 1.37 2005/08/02 22:48:28 ezk Exp $ * */ @@ -284,8 +284,15 @@ free_mntfs(opaque_t arg) * a non-positive refcount. Something is badly wrong if * we have been! Ignore the request for now... */ - if(mf->mf_refc <= 0) { - plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x", + if (mf->mf_refc <= 0) { + plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x (bug?)", + mf->mf_mount, mf->mf_refc, mf->mf_flags); + return; + } + + /* don't discard last reference of a restarted/kept mntfs */ + if (mf->mf_refc == 1 && mf->mf_flags & MFF_RSTKEEP) { + plog(XLOG_ERROR, "IGNORING free_mntfs for <%s>: refc %d, flags %x (restarted)", mf->mf_mount, mf->mf_refc, mf->mf_flags); return; } diff --git a/amd/restart.c b/amd/restart.c index 18b766d..541b10a 100644 --- a/amd/restart.c +++ b/amd/restart.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * - * $Id: restart.c,v 1.13 2005/08/02 01:28:57 ezk Exp $ + * $Id: restart.c,v 1.14 2005/08/02 22:48:28 ezk Exp $ * */ @@ -101,8 +101,8 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops) */ (void) (*fs_ops->fs_init) (mf); } - plog(XLOG_INFO, "%s restarted fstype %s on %s", - me->mnt_fsname, fs_ops->fs_type, me->mnt_dir); + plog(XLOG_INFO, "%s restarted fstype %s on %s, flags 0x%x", + me->mnt_fsname, fs_ops->fs_type, me->mnt_dir, mf->mf_flags); } else { /* Something strange happened - two mounts at the same place! */ free_mntfs(mf); -- 2.43.0