summaryrefslogtreecommitdiffstats
path: root/tests/bugs/bug-1126048.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-08-01 18:30:32 +0530
committerNiels de Vos <ndevos@redhat.com>2014-10-01 03:44:28 -0700
commitdb7d578da03a5d8bbc2169a45baea5e0e3ddc1e3 (patch)
tree514480b571412d9a01d732e35c5665a67e61722d /tests/bugs/bug-1126048.c
parent66ebbb55918645928bc479c0e723f035a4c1ec11 (diff)
mount/fuse: Handle fd resolution failuresv3.5.3beta1
Backport of http://review.gluster.org/8402 Problem: Even when the fd resolution failed, the fop is continuing on the new graph which may not have valid inode. This lead to NULL layout subvols in dht which lead to crash in fsync after graph migration. Fix: - Remove resolution error handling in FUSE_FOP as it was only added to handle fd migration failures. - check in fuse_resolve_done for fd resolution failures and fail the fop right away. - loc resolution failures are already handled in the corresponding fops. - Return errno from state->resolve.op_errno in resume functions. - Send error to fuse on frame allocation failures. - Removed unused variable state->resolved - Removed unused macro FUSE_FOP_COOKIE BUG: 1136835 Change-Id: I5074f7a9b177c54051ef37a4f73de7f8d1fcc5b7 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8595 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'tests/bugs/bug-1126048.c')
-rw-r--r--tests/bugs/bug-1126048.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/bugs/bug-1126048.c b/tests/bugs/bug-1126048.c
new file mode 100644
index 00000000000..2282bb2025e
--- /dev/null
+++ b/tests/bugs/bug-1126048.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+
+/*
+ * This function opens a file and to trigger migration failure, unlinks the
+ * file and performs graph switch (cmd passed in argv). If everything goes fine,
+ * fsync should fail without crashing the mount process.
+ */
+int
+main (int argc, char **argv)
+{
+ int ret = 0;
+ int fd = 0;
+ char *cmd = argv[1];
+
+ printf ("cmd is: %s\n", cmd);
+ fd = open("a.txt", O_CREAT|O_RDWR);
+ if (fd < 0)
+ printf ("open failed: %s\n", strerror(errno));
+
+ ret = unlink("a.txt");
+ if (ret < 0)
+ printf ("unlink failed: %s\n", strerror(errno));
+ if (write (fd, "abc", 3) < 0)
+ printf ("Not able to print %s\n", strerror (errno));
+ system(cmd);
+ sleep(1); //No way to confirm graph switch so sleep 1
+ ret = fsync(fd);
+ if (ret < 0)
+ printf ("Not able to fsync %s\n", strerror (errno));
+ return 0;
+}