[Ocfs2-tools-commits] mfasheh commits r1084 - in trunk:
libo2cb/include libocfs2/include mount.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Sep 16 19:36:45 CDT 2005
Author: mfasheh
Date: 2005-09-16 19:36:44 -0500 (Fri, 16 Sep 2005)
New Revision: 1084
Modified:
trunk/libo2cb/include/ocfs2_nodemanager.h
trunk/libocfs2/include/ocfs2_fs.h
trunk/mount.ocfs2/mount.ocfs2.c
Log:
* update tools headers to sync with the module
* mount.ocfs2 update to work with the new readonly code
- mount.ocfs2 changes were done by Sunil Mushran
Modified: trunk/libo2cb/include/ocfs2_nodemanager.h
===================================================================
--- trunk/libo2cb/include/ocfs2_nodemanager.h 2005-09-16 22:26:44 UTC (rev 1083)
+++ trunk/libo2cb/include/ocfs2_nodemanager.h 2005-09-17 00:36:44 UTC (rev 1084)
@@ -28,7 +28,7 @@
#ifndef _OCFS2_NODEMANAGER_H
#define _OCFS2_NODEMANAGER_H
-#define O2NM_API_VERSION 4
+#define O2NM_API_VERSION 5
#define O2NM_MAX_NODES 255
#define O2NM_INVALID_NODE_NUM 255
Modified: trunk/libocfs2/include/ocfs2_fs.h
===================================================================
--- trunk/libocfs2/include/ocfs2_fs.h 2005-09-16 22:26:44 UTC (rev 1083)
+++ trunk/libocfs2/include/ocfs2_fs.h 2005-09-17 00:36:44 UTC (rev 1084)
@@ -185,7 +185,8 @@
};
/* Parameter passed from mount.ocfs2 to module */
-#define OCFS2_HB_OK "hbok"
+#define OCFS2_HB_NONE "heartbeat=none"
+#define OCFS2_HB_LOCAL "heartbeat=local"
/*
* OCFS2 directory file types. Only the low 3 bits are used. The
Modified: trunk/mount.ocfs2/mount.ocfs2.c
===================================================================
--- trunk/mount.ocfs2/mount.ocfs2.c 2005-09-16 22:26:44 UTC (rev 1083)
+++ trunk/mount.ocfs2/mount.ocfs2.c 2005-09-17 00:36:44 UTC (rev 1084)
@@ -194,6 +194,24 @@
return 0;
}
+static int check_dev_readonly(const char *dev, int *dev_ro)
+{
+ int fd;
+ int ret;
+
+ fd = open(dev, O_RDONLY);
+ if (fd < 0)
+ return errno;
+
+ ret = ioctl(fd, BLKROGET, dev_ro);
+ if (ret < 0)
+ return errno;
+
+ close(fd);
+
+ return 0;
+}
+
static int check_for_hb_ctl(const char *hb_ctl_path)
{
int ret;
@@ -272,6 +290,8 @@
struct mount_options mo;
char hb_ctl_path[PATH_MAX];
char *extra = NULL;
+ int dev_ro = 0;
+ char *hbstr = NULL;
initialize_ocfs_error_table();
initialize_o2dl_error_table();
@@ -313,9 +333,17 @@
goto bail;
}
+ if (mo.flags & MS_RDONLY) {
+ ret = check_dev_readonly(mo.dev, &dev_ro);
+ if (ret) {
+ com_err(progname, ret, "device not accessible");
+ goto bail;
+ }
+ }
+
block_signals (SIG_BLOCK);
- if (!(mo.flags & MS_REMOUNT)) {
+ if (!(mo.flags & MS_REMOUNT) && !dev_ro) {
ret = start_heartbeat(hb_ctl_path, mo.dev);
if (ret) {
block_signals (SIG_UNBLOCK);
@@ -325,16 +353,21 @@
}
}
+ if (dev_ro)
+ hbstr = OCFS2_HB_NONE;
+ else
+ hbstr = OCFS2_HB_LOCAL;
+
if (mo.xtra_opts && *mo.xtra_opts) {
extra = xstrndup(mo.xtra_opts,
- strlen(mo.xtra_opts) + strlen(OCFS2_HB_OK) + 1);
- extra = xstrconcat3(extra, ",", OCFS2_HB_OK);
+ strlen(mo.xtra_opts) + strlen(hbstr) + 1);
+ extra = xstrconcat3(extra, ",", hbstr);
} else
- extra = xstrndup(OCFS2_HB_OK, strlen(OCFS2_HB_OK));
+ extra = xstrndup(hbstr, strlen(hbstr));
ret = mount(mo.dev, mo.dir, OCFS2_FS_NAME, mo.flags & ~MS_NOSYS, extra);
if (ret) {
- if (!(mo.flags & MS_REMOUNT))
+ if (!(mo.flags & MS_REMOUNT) && !dev_ro)
stop_heartbeat(hb_ctl_path, mo.dev);
block_signals (SIG_UNBLOCK);
com_err(progname, errno, "while mounting %s on %s",
More information about the Ocfs2-tools-commits
mailing list