diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2015-01-13 10:50:06 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-01-18 22:04:40 -0800 |
commit | 4f734b04694feabe047d758c2a0a6cd8ce5fc450 (patch) | |
tree | 65c3536c8db7fbedff5648acff46a83784a2ff2a /xlators/cluster/ec/src/ec-inode-read.c | |
parent | 63dc6e1942dffcddd99c5048a498ca00eead8baa (diff) |
ec: Don't use inodelk on getxattr when clearing locks
When command 'clear-locks' from cli is executed, a getxattr request
is received by ec. This request was handled as usual, first locking
the inode. Once this request was processed by the bricks, all locks
were removed, including the lock used by ec.
When ec tried to unlock the previously acquired lock (which was
already released), caused a crash in glusterfsd.
This fix executes the getxattr request without any lock acquired
for the clear-locks command.
Change-Id: I77e550d13c4673d2468a1e13fe6e2fed20e233c6
BUG: 1179050
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/9440
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index a962264fde9..9d860161ecf 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -242,15 +242,18 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - if (fop->fd == NULL) - { - ec_lock_prepare_inode(fop, &fop->loc[0], 0); - } - else - { - ec_lock_prepare_fd(fop, fop->fd, 0); + /* clear-locks commands must be done without any locks acquired + to avoid interferences. */ + if ((fop->str[0] == NULL) || + (strncmp(fop->str[0], GF_XATTR_CLRLK_CMD, + strlen(GF_XATTR_CLRLK_CMD)) != 0)) { + if (fop->fd == NULL) { + ec_lock_prepare_inode(fop, &fop->loc[0], 0); + } else { + ec_lock_prepare_fd(fop, fop->fd, 0); + } + ec_lock(fop); } - ec_lock(fop); return EC_STATE_DISPATCH; |