LDIRT = config.* conftest* Logs/* built install.* install-dev.* *.gz
SUBDIRS = include libxfs libhandle \
- bmap db fsck growfs logprint mkfile mkfs repair rtcp \
+ bmap db freeze fsck growfs logprint mkfile mkfs repair rtcp \
man doc debian build
default: $(CONFIGURE)
#
PKG_MAJOR=1
PKG_MINOR=2
-PKG_REVISION=6
+PKG_REVISION=7
PKG_BUILD=0
--- /dev/null
+#
+# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Further, this software is distributed without any warranty that it is
+# free of the rightful claim of any third person regarding infringement
+# or the like. Any license provided herein, whether implied or
+# otherwise, applies only to this software file. Patent licenses, if
+# any, provided herein do not apply to combinations of this program with
+# other software, or any other product whatsoever.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston MA 02111-1307, USA.
+#
+# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+# Mountain View, CA 94043, or:
+#
+# http://www.sgi.com
+#
+# For further information regarding this notice, see:
+#
+# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#
+
+TOPDIR = ..
+include $(TOPDIR)/include/builddefs
+
+CMDTARGET = xfs_freeze
+
+CFILES = xfs_freeze.c
+
+default: $(CMDTARGET)
+
+include $(BUILDRULES)
+
+install: default
+ $(INSTALL) -m 755 -d $(PKG_BIN_DIR)
+ $(INSTALL) -m 755 $(CMDTARGET) $(PKG_BIN_DIR)
+install-dev:
--- /dev/null
+/*
+ * Copyright (c) 2001 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like. Any license provided herein, whether implied or
+ * otherwise, applies only to this software file. Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA 94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include <libxfs.h>
+#include <sys/ioctl.h>
+#include <sys/vfs.h>
+
+char *progname;
+
+static void
+usage(void)
+{
+ fprintf(stderr,
+"Usage: %s [options] mountpoint\n\n\
+Options:\n\
+ -f freeze filesystem access\n\
+ -u unfreeze filesystem access\n",
+ progname);
+ exit(2);
+}
+
+int
+main(int argc, char **argv)
+{
+ int c; /* current option character */
+ int ffd; /* mount point file descriptor */
+ int fflag, uflag;
+ int level;
+ struct statfs buf;
+
+ fflag = uflag = 0;
+ progname = basename(argv[0]);
+ while ((c = getopt(argc, argv, "fu")) != EOF) {
+ switch (c) {
+ case 'f':
+ fflag = 1;
+ break;
+ case 'u':
+ uflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ if (argc - optind != 1)
+ usage();
+ if ((fflag + uflag) != 1)
+ usage();
+
+ ffd = open(argv[optind], O_RDONLY);
+ if (ffd < 0) {
+ perror(argv[optind]);
+ return 1;
+ }
+ fstatfs(ffd, &buf);
+ if (buf.f_type != XFS_SUPER_MAGIC) {
+ fprintf(stderr,
+ "%s: specified file is not on an XFS filesystem\n",
+ progname);
+ exit(1);
+ }
+
+ if (fflag) {
+ level = 1;
+ if (ioctl(ffd, XFS_IOC_FREEZE, &level) < 0) {
+ fprintf(stderr, "%s: cannot freeze filesystem"
+ " mounted at %s: %s\n",
+ progname, argv[optind], strerror(errno));
+ exit(1);
+ }
+ }
+
+ if (uflag) {
+ if (ioctl(ffd, XFS_IOC_THAW, &level) < 0) {
+ fprintf(stderr, "%s: cannot unfreeze filesystem"
+ " mounted at %s: %s\n",
+ progname, argv[optind], strerror(errno));
+ exit(1);
+ }
+ }
+
+ close(ffd);
+}
#define XFS_IOC_ERROR_CLEARALL _IOW('X', 117, struct xfs_error_injection)
#endif /* DEBUG || INDUCE_IO_ERROR */
#define XFS_IOC_ATTRCTL_BY_HANDLE _IOWR('X', 118, struct xfs_fsop_attr_handlereq)
+#define XFS_IOC_FREEZE _IOWR('X', 119, int)
+#define XFS_IOC_THAW _IOWR('X', 120, int)
/*
* ioctl command to export information not in standard interfaces
* 140: IRIX statvfs.f_fstr field - UUID from the superblock
/* which bits matter in rpc
log item pin masks */
uint m_cxfstype; /* mounted shared, etc. */
+ lock_t m_freeze_lock;
+ uint m_frozen;
+ sv_t m_wait_unfreeze;
+ atomic_t m_active_trans;
} xfs_mount_t;
/*
void _xfs_force_shutdown(struct xfs_mount *, int, char *, int);
int xfs_syncsub(xfs_mount_t *, int, int, int *);
void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, __int64_t);
+
+#define XFS_FREEZE_WRITE 1
+#define XFS_FREEZE_TRANS 2
+
+void xfs_start_freeze(xfs_mount_t *, int);
+void xfs_finish_freeze(xfs_mount_t *);
+void xfs_check_frozen(xfs_mount_t *, int);
+
extern struct vfsops xfs_vfsops;
#endif /* __KERNEL__ */
--- /dev/null
+.TH xfs_freeze 8
+.SH NAME
+xfs_freeze \- suspend access to an XFS filesystem
+.SH SYNOPSIS
+.nf
+\f3xfs_freeze\f1 [ \f3\-fu\f1 ] [ \f3-t\f1 mtab ] mount-point
+.fi
+.SH DESCRIPTION
+.I xfs_freeze
+Suspend and resume access to an XFS filesystem (see
+.IR xfs (5)).
+The
+.I mount-point
+argument is the pathname of the directory where the filesystem
+is mounted.
+The filesystem must be mounted to be frozen (see
+.IR mount (8)).
+.I xfs_freeze
+is intended to be used with volume managers and hardware raid devices which
+support snapshotting,
+.I xfs_freeze
+will halt new access to the filesystem and create a stable image on disk
+suitable for using as a snapshot.
+.PP
+Using the \f3\-f\f1 option, the filesystem is locked out from new
+modifications, write system calls are halted on entry, other calls
+which modify the filesystem are halted at the start of a transaction,
+all ongoing transactions in the filesystem are allowed to complete.
+.PP
+All dirty data is written out to disk, the log is flushed to disk and
+all dirty metadata is written out. The \f3\-u\f1 option is then used
+to unfreeze the filesystem and allow operations to continue.
+.PP
+The options to
+.I xfs_freeze
+are:
+.TP
+\f3\-f\f1
+Specifies that the filesystem should be frozen.
+.TP
+.B \-u
+Specifies that the filesystem should be unfrozen and new modifications
+allowed.
+.TP
+.B \-t
+Specifies an alternate mount table file (default is
+.IR /etc/mtab ).
+This is used when working with filesystems mounted without writing to
+.I /etc/mtab
+file - refer to
+.BR mount (8)
+for further details.
+.SH SEE ALSO
+lvm(8),
+mount(8).