From 07b9853ad0c92b341be33a6cd632013c416221c8 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Mon, 28 Sep 2015 17:20:19 +0530 Subject: features/trash: Create trash directory only when it is enabled Previously trash directory was being created as part of volume start operation. And also the user/admin could not delete this directory from volume even if it is not needed. This patch will fix the same. From now onwards creation and enforcement on trash directory will come into pictrure only when trash translator is enabled. Similarly exact same behaviour is reflected on internal-op directory inside trash directory. Change-Id: I3e58316a7b299a691885e458c960438bec2220fb BUG: 1264849 Signed-off-by: Jiffin Tony Thottan Reviewed-on: http://review.gluster.org/12256 Smoke: Gluster Build System Tested-by: Anoop C S NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Anoop C S Reviewed-by: Jeff Darcy --- tests/bugs/quota/bug-1288474.t | 5 +++++ tests/bugs/unclassified/bug-1357397.t | 3 +++ 2 files changed, 8 insertions(+) (limited to 'tests/bugs') diff --git a/tests/bugs/quota/bug-1288474.t b/tests/bugs/quota/bug-1288474.t index bd64df9e45c..ea6bca6cb07 100755 --- a/tests/bugs/quota/bug-1288474.t +++ b/tests/bugs/quota/bug-1288474.t @@ -22,6 +22,9 @@ TEST glusterd #Create and start a tiered volume create_dist_tier_vol $NUM_BRICKS +TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0 +touch $M0/foobar + TEST $CLI volume quota $V0 enable TEST $CLI volume quota $V0 limit-usage / 10MB @@ -39,5 +42,7 @@ mkdir $B0/hot TEST $CLI volume tier $V0 attach $H0:$B0/hot/${V0}{0..$1} EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "10.0MB" quota_list_field "/" 5 +TEST umount $M0 + cleanup; diff --git a/tests/bugs/unclassified/bug-1357397.t b/tests/bugs/unclassified/bug-1357397.t index dc76787b505..129a208e278 100644 --- a/tests/bugs/unclassified/bug-1357397.t +++ b/tests/bugs/unclassified/bug-1357397.t @@ -12,6 +12,9 @@ TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2} TEST $CLI volume start $V0 +TEST $CLI volume set $V0 features.trash on +TEST $CLI volume set $V0 features.trash-internal-op on + TEST [ -e $B0/${V0}1/.trashcan ] TEST [ -e $B0/${V0}1/.trashcan/internal_op ] -- cgit >
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mount/fuse/src/fuse-bridge.c')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c335
1 files changed, 6 insertions, 329 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index e37d2e0c8da..aea0f88b0c1 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -29,7 +29,6 @@
static int gf_fuse_conn_err_log;
static int gf_fuse_xattr_enotsup_log;
-static int gf_fuse_pre_stuck_log;
/*
@@ -537,18 +536,7 @@ fuse_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
foo.open_flags = 0;
if (!IA_ISDIR (fd->inode->ia_type)) {
- if (priv->direct_io_mode &&
- (
-#ifdef GF_LINUX_HOST_OS
- (state->flags & O_ACCMODE) != O_RDONLY ||
-#endif
-#ifdef GF_DARWIN_HOST_OS
- /* On Darwin machines, O_APPEND is not handled,
- * which may corrupt the data
- */
- (state->flags & O_ACCMODE) == O_RDONLY &&
-#endif
- priv->can_exec_directio))
+ if (priv->direct_io_mode)
foo.open_flags |= FOPEN_DIRECT_IO;
#ifdef GF_DARWIN_HOST_OS
/* In Linux: by default, buffer cache
@@ -1442,15 +1430,7 @@ fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret >= 0) {
foo.fh = (uintptr_t) fd;
- if (priv->direct_io_mode &&
- (
-#ifdef GF_LINUX_HOST_OS
- (state->flags & O_ACCMODE) != O_RDONLY ||
-#endif
-#ifdef GF_DARWIN_HOST_OS
- (state->flags & O_ACCMODE) == O_RDONLY &&
-#endif
- priv->can_exec_directio))
+ if (priv->direct_io_mode)
foo.open_flags |= FOPEN_DIRECT_IO;
gf_log ("glusterfs-fuse", GF_LOG_TRACE,
@@ -2818,9 +2798,6 @@ fuse_setlk (xlator_t *this, fuse_in_header_t *finh, void *msg)
return;
}
-
-static void *fuse_pre_test_directio_exec (void *arg);
-
static void
fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)
{
@@ -2829,9 +2806,6 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)
struct fuse_init_out fino;
fuse_private_t *priv = NULL;
int ret;
-#ifndef GF_DARWIN_HOST_OS
- pthread_t prethread = {0, };
-#endif
priv = this->private;
@@ -2893,20 +2867,6 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)
out:
GF_FREE (finh);
-
-#ifdef GF_DARWIN_HOST_OS
- /* MacFUSE applies a "mount comes after a succesful handshake"
- * strategy, which was taken from early fuse4bsd. Linux (and recent
- * fuse4bsd) is rather doing "mount, then handshake; if that fails,
- * unmount" strategy. Therefore on OS X it would be too early to
- * launch the pre-test thread here. To work this around, we launch
- * it from the LOOKUP pre-test handler (that will come instantly,
- * as OS X automatically checks for the presence of some files
- * upon a new mount).
- */
-#else
- pthread_create (&prethread, NULL, &fuse_pre_test_directio_exec, this);
-#endif
}
@@ -3075,9 +3035,11 @@ fuse_thread_proc (void *data)
struct iovec iov_in[2];
void *msg = NULL;
const size_t msg0_size = sizeof (*finh) + 128;
+ fuse_handler_t **fuse_ops = NULL;
this = data;
priv = this->private;
+ fuse_ops = priv->fuse_ops;
THIS = this;
@@ -3192,7 +3154,7 @@ fuse_thread_proc (void *data)
fuse_enosys (this, finh, msg);
else
#endif
- priv->fuse_ops[finh->opcode] (this, finh, msg);
+ fuse_ops[finh->opcode] (this, finh, msg);
iobuf_unref (iobuf);
continue;
@@ -3457,287 +3419,6 @@ fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg)
}
-/*
- * FUSE pre-test stuff
- * -------------------
- */
-
-#define FUSE_PRE_TESTFILE ".__fuse_pre_testfile"
-#define FUSE_PRE_TESTFILE1 ".__fuse_pre_testfile1"
-#define FUSE_PRE_TESTFILE_ID ((uint64_t)-1)
-#define FUSE_PRE_TESTFILE_FH ((uint64_t)1)
-
-#define FUSE_PRE_TEST_TEST do { \
- if (finh->uid != getuid () || \
- finh->nodeid != FUSE_PRE_TESTFILE_ID) \
- return fuse_std_fallback (this, finh, msg); \
-} while (0)
-
-static fuse_handler_t *fuse_std_ops[];
-
-static void
-fuse_std_fallback (xlator_t *this, fuse_in_header_t *finh, void *msg)
-{
- static int fuse_pre_cnt;
-
- if (fuse_pre_cnt++ > 200)
- GF_LOG_OCCASIONALLY (gf_fuse_pre_stuck_log,
- "glusterfs-fuse",
- GF_LOG_WARNING,
- "fuse pre test does not complete");
-
- return fuse_std_ops[finh->opcode] (this, finh, msg);
-}
-
-
-static void
-fuse_pre_lookup (xlator_t *this, fuse_in_header_t *finh, void *msg)
-{
- char *name = msg;
- fuse_private_t *priv = NULL;
- struct fuse_entry_out feo = {0, };
- unsigned pre_testfile[2] = {0, 0};
-#ifdef GF_DARWIN_HOST_OS
- static int prethread_spawn;
- pthread_t prethread = {0, };
-
- if (!prethread_spawn) {
- prethread_spawn = 1;
- pthread_create (&prethread, NULL, &fuse_pre_test_directio_exec,
- this);
- }
-#endif
-
- priv = this->private;
-
- pre_testfile[0] = !strcmp (name, FUSE_PRE_TESTFILE);
- pre_testfile[1] = !strcmp (name, FUSE_PRE_TESTFILE1);
- if (finh->uid != getuid () ||
- finh->nodeid != 1 ||
- !(pre_testfile[0] || pre_testfile[1]))
- return fuse_std_fallback (this, finh, msg);
-
- if (priv->pre_test_stage == 0 && pre_testfile[1]) {
- send_fuse_err (this, finh, ENOENT);
-
- return;
- }
-
- memset (&feo, 0, sizeof (feo));
- feo.nodeid = FUSE_PRE_TESTFILE_ID;
- feo.attr.ino = FUSE_PRE_TESTFILE_ID;
- feo.attr.mode = (priv->pre_test_stage == 2 ? S_IFDIR : S_IFREG) | 0755;
- feo.attr.nlink = 1;
-
-#if FUSE_KERNEL_MINOR_VERSION >= 9
- priv->proto_minor >= 9 ?
- send_fuse_obj (this, finh, &feo) :
- send_fuse_data (this, finh, &feo,
- FUSE_COMPAT_ENTRY_OUT_SIZE);
-#else
- send_fuse_obj (this, finh, &feo);
-#endif
-}
-
-
-static void
-fuse_pre_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
-{
- fuse_private_t *priv = NULL;
- struct fuse_attr_out fao = {0, };
-
- priv = this->private;
-
- FUSE_PRE_TEST_TEST;
-
- fao.attr.mode = (priv->pre_test_stage == 2 ? S_IFDIR : S_IFREG) | 0755;
- fao.attr.nlink = 1;
-
-#if FUSE_KERNEL_MINOR_VERSION >= 9
- priv->proto_minor >= 9 ?
- send_fuse_obj (this, finh, &fao) :
- send_fuse_data (this, finh, &fao,
- FUSE_COMPAT_ATTR_OUT_SIZE);
-#else
- send_fuse_obj (this, finh, &fao);
-#endif
-}
-
-
-static void
-fuse_pre_open (xlator_t *this, fuse_in_header_t *finh, void *msg)