From 1b81834b454221a0e4a2b0548cefedc611ff882c Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 29 Jul 2019 14:08:37 +0530 Subject: cluster/ec: Fix reopen flags to avoid misbehavior Problem: when a file needs to be re-opened O_APPEND and O_EXCL flags are not filtered in EC. - O_APPEND should be filtered because EC doesn't send O_APPEND below EC for open to make sure writes happen on the individual fragments instead of at the end of the file. - O_EXCL should be filtered because shd could have created the file so even when file exists open should succeed - O_CREAT should be filtered because open happens with gfid as parameter. So open fop will create just the gfid which will lead to problems. Fix: Filter out these two flags in reopen. Change-Id: Ia280470fcb5188a09caa07bf665a2a94bce23bc4 Fixes: bz#1739426 Signed-off-by: Pranith Kumar K --- xlators/cluster/ec/src/ec-inode-write.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/ec/src/ec-inode-write.c') diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c index ec1c5b5d85c..49cb8c147e4 100644 --- a/xlators/cluster/ec/src/ec-inode-write.c +++ b/xlators/cluster/ec/src/ec-inode-write.c @@ -1981,10 +1981,13 @@ ec_get_lock_good_mask(inode_t *inode, xlator_t *xl) LOCK(&inode->lock); { ictx = __ec_inode_get(inode, xl); - lock = ictx->inode_lock; + if (ictx) + lock = ictx->inode_lock; } UNLOCK(&inode->lock); - return lock->good_mask; + if (lock) + return lock->good_mask; + return 0; } void -- cgit