Re: [PATCH] Graceful failure in devfs_remove() in 2.5.x

From: Pavel Roskin (proski@gnu.org)
Date: Wed May 28 2003 - 11:03:49 EST


On Wed, 28 May 2003, Christoph Hellwig wrote:

> On Tue, May 27, 2003 at 11:29:53AM -0400, Pavel Roskin wrote:
> > This patch makes devfs_remove() print an error to the kernel log and
> > continue. PRINTK is defined in fs/devfs/base.c to report errors in the
> > cases like this one:
>
> Patch looks okay _except_ for use of this gross macro. Just
> ise plain printk instead.

I always try to follow the existing code style, but if you want me to make
an exception, here it is. Fixed patch is attached.

--
Regards,
Pavel Roskin--- linux.orig/fs/devfs/base.c
+++ linux/fs/devfs/base.c
@@ -1710,6 +1710,12 @@ void devfs_remove(const char *fmt, ...)
if (n < 64 && buf[0]) {
devfs_handle_t de = _devfs_find_entry(NULL, buf, 0);

+ if (!de) {
+ printk(KERN_ERR "%s: %s not found, cannot remove\n",
+ __FUNCTION__, buf);
+ return;
+ }
+
write_lock(&de->parent->u.dir.lock);
_devfs_unregister(de->parent, de);
devfs_put(de);