Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=734893a88b…
Commit: 734893a88b91e8ed87ca20a084bdbbf48a2125f8
Parent: 60c26b020f55e079add1f461897b8f8d36b4e769
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Feb 26 09:49:07 2015 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Feb 26 09:49:07 2015 -0600
fsck.gfs2: Fix coverity error in pass4.c
This simple patch checks for lf_dip (the lost+found inode) being NULL,
and if it is, returns at the end of function scan_inode_list. This is
fixing a false positive spotted by coverity, but it makes the code a
bit more intuitive.
---
gfs2/fsck/pass4.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index f307782..850a2fe 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -177,7 +177,9 @@ static int scan_inode_list(struct gfs2_sbd *sdp) {
(unsigned long long)ii->di_num.no_addr, ii->di_nlink);
} /* osi_list_foreach(tmp, list) */
- if (lf_dip && astate_changed(lf_dip, &lf_as))
+ if (lf_dip == NULL)
+ return 0;
+ if (astate_changed(lf_dip, &lf_as))
reprocess_inode(lf_dip, "lost+found");
if (lf_addition) {
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=0031db202e1b6…
Commit: 0031db202e1b6584c5069f7f3139c1303257a3aa
Parent: 407dbe2a3df3882a1e936e37e7c0a8505a2d44ac
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Feb 23 14:12:46 2015 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Mon Feb 23 18:39:22 2015 +0000
libgfs2: Use a matching context mount option in mount_gfs2_meta
On a system with SELinux enabled, if a gfs2 file system is mounted with
a context= option, the tools gfs2_quota, gfs2_tool, gfs2_grow and
gfs2_jadd will fail with "Device or resource busy". This is due to
SELinux failing the mount due to a mismatched context ("SELinux: mount
invalid. Same superblock, different security settings").
In order to work around this, parse the context option of the gfs2 mount
point in is_pathname_mounted() and use it in mount_gfs2_meta().
Resolves: rhbz#1121693
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 9c20f11..25286d1 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -217,6 +217,7 @@ struct gfs2_sbd {
int device_fd;
int path_fd;
+ char *secontext;
uint64_t sb_addr;
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 8e0ca6f..5ef4a2a 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -100,6 +100,24 @@ int compute_constants(struct gfs2_sbd *sdp)
return 0;
}
+/**
+ * Returns a duplicate of the 'context' mount option, or NULL if not found.
+ */
+static char *copy_context_opt(struct mntent *mnt)
+{
+ char *ctx, *end;
+
+ ctx = hasmntopt(mnt, "context");
+ if (ctx == NULL)
+ return NULL;
+
+ end = strchr(ctx, ',');
+ if (end == NULL)
+ return NULL;
+
+ return strndup(ctx, end - ctx);
+}
+
int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
FILE *fp;
@@ -161,6 +179,7 @@ int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
return 0;
if (hasmntopt(mnt, MNTOPT_RO))
*ro_mount = 1;
+ sdp->secontext = copy_context_opt(mnt);
return 1; /* mounted */
}
@@ -319,7 +338,7 @@ int mount_gfs2_meta(struct gfs2_sbd *sdp)
sigaction(SIGCONT, &sa, NULL);
sigaction(SIGUSR1, &sa, NULL);
sigaction(SIGUSR2, &sa, NULL);
- ret = mount(sdp->path_name, sdp->metafs_path, "gfs2meta", 0, NULL);
+ ret = mount(sdp->path_name, sdp->metafs_path, "gfs2meta", 0, sdp->secontext);
if (ret) {
rmdir(sdp->metafs_path);
return -1;