summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r--xlators/features/locks/src/common.c2
-rw-r--r--xlators/features/locks/src/posix.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index 6e7fb4b2f63..9e06484308e 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -478,7 +478,7 @@ pl_inode_get(xlator_t *this, inode_t *inode, pl_local_t *local)
unlock:
UNLOCK(&inode->lock);
- if (pl_is_mandatory_locking_enabled(pl_inode) &&
+ if ((pl_inode != NULL) && pl_is_mandatory_locking_enabled(pl_inode) &&
pl_inode->check_mlock_info && local) {
/* Note: The lock enforcement information per file can be stored in the
attribute flag of stat(x) in posix. With that there won't be a need
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 3f1c7a733ff..9d7210f1bb5 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -125,6 +125,11 @@ fetch_pathinfo(xlator_t *, inode_t *, int32_t *, char **);
(name && (strcmp(name, GF_ENFORCE_MANDATORY_LOCK) == 0))) { \
inode_t *__inode = (loc ? loc->inode : fd->inode); \
pl_inode_t *__pl_inode = pl_inode_get(this, __inode, NULL); \
+ if (__pl_inode == NULL) { \
+ op_ret = -1; \
+ op_errno = ENOMEM; \
+ goto unwind; \
+ } \
if (!pl_is_mandatory_locking_enabled(__pl_inode) || \
!priv->mlock_enforced) { \
op_ret = -1; \