summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-01-21 13:12:11 -0800
committerAnand Avati <avati@redhat.com>2013-01-28 16:44:51 -0800
commita81748c3f49790e78ef168e25db025d0da838338 (patch)
tree3190d2c44c5b47d09da1046f89af2d241a6c7145
parent54c68942b456ffa8d15b39b43a7723712b2a1a25 (diff)
fd: filter anonymous FD from fd_lookup() result
Those callers whose requirements can accommodate an anonymous FD need to call fd_anonymous(). fd_lookup() is strictly for open()ed file descriptors only. Change-Id: I5d8da3db0f44b2e2161d345d7a662cfd4ef87500 BUG: 846240 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/4404 Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--libglusterfs/src/fd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index f1933b3d613..f9466bbf4cc 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -659,6 +659,12 @@ __fd_lookup (inode_t *inode, uint64_t pid)
list_for_each_entry (iter_fd, &inode->fd_list, inode_list) {
+ if (iter_fd->anonymous)
+ /* If someone was interested in getting an
+ anonymous fd (or was OK getting an anonymous fd),
+ they can as well call fd_anonymous() directly */
+ continue;
+
if (!pid || iter_fd->pid == pid) {
fd = __fd_ref (iter_fd);
break;