Re: Revertion of bad "cleanup".

From: Rogier Wolff (R.E.Wolff@bitwizard.nl)
Date: Thu Jul 06 2000 - 08:17:04 EST


Alan Cox wrote:
>
> I'd agree misc is now wrong.

OK. So here is the "final" patch.

                        Roger.

diff -ur linux-2.4.0-test3-pre2.clean/drivers/char/misc.c linux-2.4.0-test3-pre2.miscfix/drivers/char/misc.c
--- linux-2.4.0-test3-pre2.clean/drivers/char/misc.c Wed Jul 5 11:09:58 2000
+++ linux-2.4.0-test3-pre2.miscfix/drivers/char/misc.c Thu Jul 6 12:18:49 2000
@@ -134,8 +134,11 @@
 
         old_fops = file->f_op;
         file->f_op = fops_get(c->fops);
- if (file->f_op && file->f_op->open)
- err=file->f_op->open(inode,file);
+ if (file->f_op) {
+ err = 0;
+ if (file->f_op->open)
+ err=file->f_op->open(inode,file);
+ }
         if (err) {
                 fops_put(file->f_op);
                 file->f_op = fops_get(old_fops);
diff -ur linux-2.4.0-test3-pre2.clean/fs/devices.c linux-2.4.0-test3-pre2.miscfix/fs/devices.c
--- linux-2.4.0-test3-pre2.clean/fs/devices.c Wed Jul 5 11:10:16 2000
+++ linux-2.4.0-test3-pre2.miscfix/fs/devices.c Thu Jul 6 14:37:35 2000
@@ -150,6 +150,13 @@
                 if (filp->f_op->open != NULL)
                         ret = filp->f_op->open(inode,filp);
         }
+ /* On error, our caller, dentry_open in open.c will release
+ * the fops we just claimed. We loose the reference to
+ * def_chr_fops without fops_put. That's -=currently=- fine,
+ * as fops_put only decrements usage counts for modules, and
+ * this file cannot be a module. -- REW
+ */
+
         return ret;
 }
 

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jul 07 2000 - 21:00:18 EST