From: Daisuke Ogino Date: Tue, 26 Jul 2011 23:08:37 +0000 (-0700) Subject: procfs: return ENOENT on opening a being-removed proc entry X-Git-Tag: v3.1-rc1~195 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2857e79a2ba7c155eaa1a7d3581c8d26b31e54e;p=platform%2Fupstream%2Fkernel-adaptation-pc.git procfs: return ENOENT on opening a being-removed proc entry Change the return value to ENOENT. This return value is then returned when opening the proc entry that have been removed. For example, open("/proc/bus/pci/XX/YY") when the corresponding device is being hot-removed. Signed-off-by: Daisuke Ogino Cc: Jesse Barnes Acked-by: Alexey Dobriyan Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 74b48cf..7ed72d6 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -319,7 +319,7 @@ static int proc_reg_open(struct inode *inode, struct file *file) if (!pde->proc_fops) { spin_unlock(&pde->pde_unload_lock); kfree(pdeo); - return -EINVAL; + return -ENOENT; } pde->pde_users++; open = pde->proc_fops->open;