Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master castfs by Vlad Glagolev (d091ad070a0d251ca9d246d83be211fa004059e4)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Vlad Glagolev <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master castfs by Vlad Glagolev (d091ad070a0d251ca9d246d83be211fa004059e4)
  • Date: Sun, 22 Mar 2015 17:30:34 -0500

GIT changes to master castfs by Vlad Glagolev <stealth AT sourcemage.org>:

AUTHORS | 20 +++++++++-----------
ChangeLog | 18 ++++++++++++++++++
configure.ac | 46 ++++++++++++++++++++++++++++++++++++++++++++++
configure.in | 46 ----------------------------------------------
include/castfs.h | 1 +
src/castfs.c | 47 +++++++++++++++--------------------------------
src/utils.c | 7 ++++---
7 files changed, 93 insertions(+), 92 deletions(-)

New commits:
commit d091ad070a0d251ca9d246d83be211fa004059e4
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

force single-threaded mode to fix multijob installs in rare cases

commit 1f8c749883414a50acabdc0e17fcf166f834a2a3
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

updated authors

commit ad8c929b839a32d08a8429c3c6575e9b97143a1d
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

use dynamic version info; updated configure template

commit ef3879dbef542b460111f1f371d554c7dca76ad8
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

do not modify command-line arguments directly in memory

commit 4af34740f4d7ae03af251cdbc8caf7465920f5b8
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

fixed possible race condition by removing of fgetattr call

commit a31e320474e7c1c81fe9d5b705b5156aa64f37f8
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

fixed the warning: implicit declaration of function

commit 56bc9f2f8f3b4c73ae862fb94ca80b47e3578017
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

added ability to use '-o debug' option

commit 45a8a07221303f11aa1f10a59d16aacf8531e78f
Author: Vlad Glagolev <stealth AT sourcemage.org>
Commit: Vlad Glagolev <stealth AT sourcemage.org>

fixed warnings after compilation with -Wall flag

diff --git a/AUTHORS b/AUTHORS
index 0c9b948..ef52fdb 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,19 +1,17 @@
-Current repo Admin:
- Elisamuel Resto
- <ryuji AT sourcemage.org>
-
Current Maintainer:
- Dale E. Edmons
- <linuxfan AT sourcemage.org>
+ Vlad Glagolev <stealth AT sourcemage.org>

-Tester and/or other lurkers:
- lynxlynxlynx AT mages.org
- flux_control AT sourcemage.org
+Testers and/or other lurkers:
+ Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ Justin Boffemmyer <flux AT sourcemage.org>

-------------------------------------------------
Please do not contact any of the following with questions on the
current development.

+Previous Maintainers:
+ Dale E. Edmons <linuxfan AT sourcemage.org>
+ Elisamuel Resto <ryuji AT sourcemage.org>
+
Original Author:
- David Brown
- <dmlb2000 AT gmail.com>
+ David Brown <dmlb2000 AT gmail.com>
diff --git a/ChangeLog b/ChangeLog
index 28a49b2..325a738 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2015-03-22 Vlad Glagolev <stealth AT sourcemage.org>
+ * configure.in: -> configure.ac; updated spell version to 0.6.2
+ * src/castfs.c: use dynamic version value; force single-threaded mode
+ to prevent race conditions in multijob (make -j N) installs (fuse is
+ thread-safe, but we need more investingation on how make and castfs
+ are for different filesystems
+ * AUTHORS: updated
+
+2015-03-21 Vlad Glagolev <stealth AT sourcemage.org>
+ * src/castfs.c: handle mkfifo/mknod return value; removed fgetattr
call
+ which can lead to race condition in some rare cases
+ (see http://marc.info/?l=linux-fsdevel&m=124442640826290&w=2); do
not
+ modify command-line arguments directly: this breaks them in a
process
+ tree
+ * src/utils.c: removed unused variable; added ability to use '-o
debug'
+ option
+ * include/castfs.h: declare stage_not_in_mnt()
+
2012-09-10 Vlad Glagolev <stealth AT sourcemage.org>
* src/castfs.c: fixed segfault, when running without any arguments

diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..378e81d
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,46 @@
+AC_INIT(castfs, 0.6.2)
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+
+AM_MAINTAINER_MODE
+
+AC_ARG_ENABLE(debug,
+AC_HELP_STRING([--enable-debug],[Enable debug flags]),
+ [ CFLAGS="$CFLAGS -Wall -g" ],
+ [])
+
+AC_ARG_WITH(pkgconfigdir,
+AC_HELP_STRING([--with-pkgconfigdir=DIR],[pkgconfig file in DIR
@<:@LIBDIR/pkgconfig@:>@]),
+ [pkgconfigdir=$withval],
+ [pkgconfigdir='${libdir}/pkgconfig'])
+AC_SUBST(pkgconfigdir)
+
+CPPFLAGS="${CPPFLAGS} `pkg-config --cflags fuse` -D_REENTRANT
-DFUSE_USE_VERSION=25"
+
+AC_CHECK_HEADERS(fuse.h,, AC_MSG_ERROR([fuse 2.4 or newer is required to
build castfs]))
+
+AC_CHECK_LIB(fuse, fuse_main,, AC_MSG_ERROR([fuse 2.4 or newer is required
to build castfs]))
+
+FUSE_PREFIX=`pkg-config --variable=exec_prefix fuse `
+AC_SUBST(FUSE_PREFIX,PREFIX,DATAROOTDIR)
+
+AC_ARG_ENABLE(static-fuse,
+AC_HELP_STRING([--enable-static-fuse], [Enable building castfs against fuse
statically]),
+[static_fuse=${enableval}], [static_fuse=no])
+
+if test "x$static_fuse" = "xyes"
+then
+ LIBS=`pkg-config --libs fuse | sed
's/-lfuse/$(FUSE_PREFIX)\/lib\/libfuse.a -lrt/'`
+fi
+
+AC_CHECK_FUNCS([setxattr])
+
+AC_CONFIG_FILES([
+Makefile
+include/Makefile
+src/Makefile
+test/Makefile
+debian/Makefile
+include/config.h
+])
+AC_OUTPUT
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 584190a..0000000
--- a/configure.in
+++ /dev/null
@@ -1,46 +0,0 @@
-AC_INIT(castfs, 0.5.1)
-AM_INIT_AUTOMAKE
-AC_PROG_CC
-
-AM_MAINTAINER_MODE
-
-AC_ARG_ENABLE(debug,
-AC_HELP_STRING([--enable-debug],[Enable debug flags]),
- [ CFLAGS="$CFLAGS -Wall -g" ],
- [])
-
-AC_ARG_WITH(pkgconfigdir,
-AC_HELP_STRING([--with-pkgconfigdir=DIR],[pkgconfig file in DIR
@<:@LIBDIR/pkgconfig@:>@]),
- [pkgconfigdir=$withval],
- [pkgconfigdir='${libdir}/pkgconfig'])
-AC_SUBST(pkgconfigdir)
-
-CPPFLAGS="${CPPFLAGS} `pkg-config --cflags fuse` -D_REENTRANT
-DFUSE_USE_VERSION=25"
-
-AC_CHECK_HEADERS(fuse.h,, AC_MSG_ERROR([fuse 2.4 or newer is required to
build castfs]))
-
-AC_CHECK_LIB(fuse, fuse_main,, AC_MSG_ERROR([fuse 2.4 or newer is required
to build castfs]))
-
-FUSE_PREFIX=`pkg-config --variable=exec_prefix fuse `
-AC_SUBST(FUSE_PREFIX,PREFIX,DATAROOTDIR)
-
-AC_ARG_ENABLE(static-fuse,
-AC_HELP_STRING([--enable-static-fuse], [Enable building castfs against fuse
statically]),
-[static_fuse=${enableval}], [static_fuse=no])
-
-if test "x$static_fuse" = "xyes"
-then
- LIBS=`pkg-config --libs fuse | sed
's/-lfuse/$(FUSE_PREFIX)\/lib\/libfuse.a -lrt/'`
-fi
-
-AC_CHECK_FUNCS([setxattr])
-
-AC_CONFIG_FILES([
-Makefile
-include/Makefile
-src/Makefile
-test/Makefile
-debian/Makefile
-include/config.h
-])
-AC_OUTPUT
diff --git a/include/castfs.h b/include/castfs.h
index 005eadf..758d9d1 100644
--- a/include/castfs.h
+++ b/include/castfs.h
@@ -50,6 +50,7 @@ int cast_copy_file(const char *from, const char *to);
int cast_paths_log(cast_paths_ptr paths);
int cast_mkdir_rec_staged(cast_paths_ptr dir);
int parse_mount_options(char *str);
+int stage_not_in_mnt(const char *mnt, const char *stage);
void strip_out_arguments(char *arg);
int shouldIgnore(const char *path);

diff --git a/src/castfs.c b/src/castfs.c
index 3211789..3d2dea8 100644
--- a/src/castfs.c
+++ b/src/castfs.c
@@ -25,32 +25,6 @@ static int cast_getattr(const char *path, struct stat
*stbuf)
return 0;
}

-/* shouldn't this be nearly identical to above? This won't stage, will it?
*/
-static int cast_fgetattr(const char *path, struct stat *stbuf,
- struct fuse_file_info *fi)
-{
-//fprintf(stderr, "cast_fgetattr: %s\n", path);
- int res;
- cast_log(CAST_DBG_SYS, "fgetattr %s\n", path);
-#if 1 // 0=old behavior; 1=new behavior
- char *cpath = strdup(path);
- cast_paths_ptr paths = castHashGetValueOf(cpath);
-
- cast_log(CAST_DBG_SYS, "\tfgetattr %s\n", cpath);
- cast_paths_log(paths);
- if (paths && paths->is_staged)
- res = lstat(paths->stage_path, stbuf);
- // Not sure this is correct, but I think it is! --D.E.
- else
- //res = fstat(cpath, stbuf);
-#endif
- res = fstat(fi->fh, stbuf);
- if (res == -1)
- return -errno;
-
- return 0;
-}
-
static int cast_access(const char *path, int mask)
{
//fprintf(stderr, "cast_access: %s\n", path);
@@ -192,6 +166,10 @@ static int cast_mknod(const char *path, mode_t mode,
dev_t rdev)
res = mkfifo(paths->stage_path, mode);
else
res = mknod(paths->stage_path, mode, rdev);
+
+ if (res == -1)
+ return -errno;
+
paths->is_staged = 1;
paths->is_deleted = 0;
return 0;
@@ -684,7 +662,6 @@ static int cast_releasedir(const char *path, struct
fuse_file_info *fi)

static struct fuse_operations cast_oper = {
.getattr = cast_getattr,
- .fgetattr = cast_fgetattr,
.access = cast_access,
.readlink = cast_readlink,
.opendir = cast_opendir,
@@ -721,7 +698,8 @@ static struct fuse_operations cast_oper = {
int main(int argc, char *argv[], char *env[])
{
int i, dbgdef;
- char *new_argv[argc], *logptr, *dbgptr, deflog[]="/tmp/castfs.log";
+ char *new_argv[argc + 1], *tmp_argv, *logptr, *dbgptr,
deflog[]="/tmp/castfs.log";
+ char *singlethreaded = "-s";
int new_argc = 0;

/* get environmental vars and open fd's for log file */
@@ -734,7 +712,7 @@ int main(int argc, char *argv[], char *env[])
}

if(strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-v") == 0) {
- fprintf(stdout, "castfs: version 0.6-git\n"); /* FIXME: s/b
dynamic */
+ fprintf(stdout, "castfs: version %s\n", PACKAGE_VERSION);
exit(0);
} else if(strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") ==
0) {
usage();
@@ -759,7 +737,7 @@ int main(int argc, char *argv[], char *env[])
} else {
dbgdef = 0;
/* comment out the following not used in default */
- dbgdef |= CAST_DBG_MAIN;
+ dbgdef |= CAST_DBG_MAIN;
/* dbgdef |= CAST_DBG_SYS; */
/* dbgdef |= CAST_DBG_UTIL; */
/* dbgdef |= CAST_DBG_PATHS; */
@@ -785,13 +763,15 @@ int main(int argc, char *argv[], char *env[])
for (i = 0; i < argc; i++) {
if (strcmp(argv[i], "-o")==0) {
if (parse_mount_options(argv[i + 1])) {
- strip_out_arguments(argv[i + 1]);
- if (strlen(argv[i + 1]) == 0) {
+ tmp_argv = strdup(argv[i + 1]);
+ strip_out_arguments(tmp_argv);
+ if (strlen(tmp_argv) == 0) {
i++;
} else {
new_argv[new_argc] = argv[i];
new_argc++;
}
+ free(tmp_argv);
}
} else {
new_argv[new_argc] = argv[i];
@@ -804,6 +784,9 @@ int main(int argc, char *argv[], char *env[])
exit(-1);
}

+ // enforce single-threaded mode for fuse to avoid multijob install
races
+ new_argv[new_argc] = singlethreaded;
+
cast_log(CAST_DBG_MAIN, "mount path %s\n", mount_path);
cast_log(CAST_DBG_MAIN, "stage path %s\n", stage_path);
for (i = 0; i < ignored_dirs_len; i++)
diff --git a/src/utils.c b/src/utils.c
index 7b195e7..1e1af79 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -3,7 +3,7 @@

void usage()
{
- fprintf(stderr,
+ fprintf(stderr,
"\ncastfs <mount-point> -o stage=<stage-dir>\n"
"\n\texport CASTFS_LOGFILE=/tmp/castfs.log\t# Default\n"
"\texport CASTFS_DBGLVL=15\t\t\t# Default\n"
@@ -164,6 +164,8 @@ int parse_mount_options(char *str)
sizeof(char *) * ignored_dirs_len);
ignored_dirs[ignored_dirs_len - 1] = strdup(token +
7);
clean_cast_path(ignored_dirs[ignored_dirs_len - 1]);
+ } else if (!strncmp("debug", token, 5)) {
+ found++;
}
token = strtok(NULL, ",");
}
@@ -192,9 +194,8 @@ int shouldIgnore(const char *path)
int stage_not_in_mnt(const char *mnt, const char *stage)
{
int n;
- char tmp[128];

- n = strlen(mnt); tmp[0]=0;
+ n = strlen(mnt);

if(strncmp(mnt, stage, n) == 0) {
fprintf(stderr, "castfs: Error, stage is a subdir to mnt\n");



  • [SM-Commit] GIT changes to master castfs by Vlad Glagolev (d091ad070a0d251ca9d246d83be211fa004059e4), Vlad Glagolev, 03/22/2015

Archive powered by MHonArc 2.6.24.

Top of Page