Skip to contentSkip to conversation

fs: Properly pair fget_light/fput_light in fdget/fdput

PATCH New Rasmus Villemoes 1 participant 1 message Jun 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: Properly pair fget_light/fput_light in fdget/fdput

fdget() is implemented using fget_light(). Its companion fdput() currently open-codes the behaviour of fput_light(). This is slightly confusing. To follow the documentation in fs/file.c:688ff to the letter, use fput_light() in fdput().

---
 include/linux/file.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/file.h +1 -2
index cbacf4f..30be9b0 100644
@@ -33,8 +33,7 @@ struct fd {
 
 static inline void fdput(struct fd fd)
 {
-	if (fd.need_put)
-		fput(fd.file);
+	fput_light(fd.file, fd.need_put);
 }
 
 extern struct file *fget(unsigned int fd);
Signature · 1 line
1.7.9.5