summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/stripe
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-05-27 17:49:10 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-11 08:15:24 -0700
commita20d4929663ccbfa45d574d62240a5277b47ab39 (patch)
tree7ed1bfd024f5b29bd1bbfdf40afd09d377e1cf17 /xlators/cluster/stripe
parentd918b28cf3df2826656fef868f1825f4e6c45723 (diff)
stripe: don't allow entry modification operations when any node is down
if entry modification operations (like create/mknod/rename) happen when there is a node down, there will be inconsistency in striped fs. rather than curing it, prevent the issue from happening Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/cluster/stripe')
-rw-r--r--xlators/cluster/stripe/src/stripe.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 11d6172f9..515064c9d 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -871,7 +871,8 @@ stripe_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
priv = this->private;
trav = this->children;
- if (priv->first_child_down) {
+ /* If any one node is down, don't allow rename */
+ if (priv->nodes_down) {
op_errno = ENOTCONN;
goto err;
}
@@ -987,13 +988,19 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
goto err;
}
- if (S_ISDIR (loc->inode->st_mode) || S_ISREG (loc->inode->st_mode))
+ if (S_ISREG (loc->inode->st_mode))
send_fop_to_all = 1;
if (!send_fop_to_all) {
STACK_WIND (frame, stripe_common_cbk, trav->xlator,
trav->xlator->fops->unlink, loc);
} else {
+ /* Don't unlink a file if a node is down */
+ if (priv->nodes_down) {
+ op_errno = ENOTCONN;
+ goto err;
+ }
+
/* Initialization */
local = CALLOC (1, sizeof (stripe_local_t));
if (!local) {
@@ -1066,7 +1073,8 @@ stripe_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
priv = this->private;
trav = this->children;
- if (priv->first_child_down) {
+ /* don't delete a directory if any of the subvolume is down */
+ if (priv->nodes_down) {
op_errno = ENOTCONN;
goto err;
}
@@ -1489,12 +1497,12 @@ stripe_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
priv = this->private;
trav = this->children;
- if (priv->first_child_down) {
+ /* If any one node is down, don't allow link operation */
+ if (priv->nodes_down) {
op_errno = ENOTCONN;
goto err;
}
-
if (S_ISREG (oldloc->inode->st_mode))
send_fop_to_all = 1;