From a81748c3f49790e78ef168e25db025d0da838338 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 21 Jan 2013 13:12:11 -0800 Subject: 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 Reviewed-on: http://review.gluster.org/4404 Tested-by: Gluster Build System --- libglusterfs/src/fd.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libglusterfs') 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; -- cgit