gfs2-utils: master - gfs2_quota: fix uninitialized fiemap flags

Abhijith Das adas at fedoraproject.org
Tue Mar 2 01:10:30 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=c4b41dc01efd1ebbdbe2b6337543a0ff43bcefa5
Commit:        c4b41dc01efd1ebbdbe2b6337543a0ff43bcefa5
Parent:        d67c1edbb7711f17d7967ff4072ac05bb77b74b9
Author:        Abhijith Das <adas at redhat.com>
AuthorDate:    Mon Mar 1 19:00:41 2010 -0600
Committer:     Abhijith Das <adas at redhat.com>
CommitterDate: Mon Mar 1 19:09:33 2010 -0600

gfs2_quota: fix uninitialized fiemap flags

This patch zeroes out the fmap.fm_flags field before
calling the fiemap ioctl. Uninitialized flags will
cause gfs2 to throw the "Invalid request descriptor"
error.

rhbz#536902
---
 gfs2/quota/check.c |    2 ++
 gfs2/quota/main.c  |    6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gfs2/quota/check.c b/gfs2/quota/check.c
index f60a80f..7bd31ad 100644
--- a/gfs2/quota/check.c
+++ b/gfs2/quota/check.c
@@ -222,6 +222,7 @@ read_quota_file(struct gfs2_sbd *sdp, commandline_t *comline,
         }
 	quota_file_size = statbuf.st_size;
 	/* First find the number of extents in the quota file */
+	fmap.fm_flags = 0;
 	fmap.fm_start = 0;
 	fmap.fm_length = (~0ULL);
 	error = ioctl(fd, FS_IOC_FIEMAP, &fmap);
@@ -235,6 +236,7 @@ read_quota_file(struct gfs2_sbd *sdp, commandline_t *comline,
 		fprintf(stderr, "malloc error (%d): %s\n", errno, strerror(errno));
 		goto out;
 	}
+	fmap2->fm_flags = 0;
 	fmap2->fm_start = 0;
 	fmap2->fm_length = (~0ULL);
 	fmap2->fm_extent_count = fmap.fm_mapped_extents;
diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
index 1b54162..69a5ce7 100644
--- a/gfs2/quota/main.c
+++ b/gfs2/quota/main.c
@@ -369,8 +369,8 @@ do_reset(struct gfs2_sbd *sdp, commandline_t *comline)
 	if (!*comline->filesystem)
 		die("need a filesystem to work on\n");
 
-	printf("This operation will permanently erase all quota information. "
-	       "You will have to re-assign all quota limit/warn values. "
+	printf("This operation will permanently erase all quota information.\n"
+	       "You will have to re-assign all quota limit/warn values.\n"
 	       "Proceed [y/N]? ");
 	c = getchar();
 	if (c != 'y' && c != 'Y')
@@ -478,6 +478,7 @@ do_list(struct gfs2_sbd *sdp, commandline_t *comline)
 	}
 	quota_file_size = statbuf.st_size;
 	/* First find the number of extents in the quota file */
+	fmap.fm_flags = 0;
 	fmap.fm_start = 0;
 	fmap.fm_length = (~0ULL);
 	error = ioctl(fd, FS_IOC_FIEMAP, &fmap);
@@ -491,6 +492,7 @@ do_list(struct gfs2_sbd *sdp, commandline_t *comline)
 		fprintf(stderr, "malloc error (%d): %s\n", errno, strerror(errno));
 		goto out;
 	}
+	fmap2->fm_flags = 0;
 	fmap2->fm_start = 0;
 	fmap2->fm_length = (~0ULL);
 	fmap2->fm_extent_count = fmap.fm_mapped_extents;


More information about the cluster-commits mailing list