Showing error 978

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: fs/jffs2/fs.c
Line in file: 631
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

601                   happened while we were contemplating. In order to ensure
602                   that we don't cause a new read_inode() (which would fail)
603                   for the inode in question, we use ilookup() in this case
604                   instead of iget().
605
606                   The nlink can't _become_ zero at this point because we're
607                   holding the alloc_sem, and jffs2_do_unlink() would also
608                   need that while decrementing nlink on any inode.
609                */
610                inode = ilookup(OFNI_BS_2SFFJ(c), inum);
611                if (!inode) {
612                        D1(printk(KERN_DEBUG "ilookup() failed for ino #%u; inode is probably deleted.\n",
613                                  inum));
614
615                        spin_lock(&c->inocache_lock);
616                        ic = jffs2_get_ino_cache(c, inum);
617                        if (!ic) {
618                                D1(printk(KERN_DEBUG "Inode cache for ino #%u is gone.\n", inum));
619                                spin_unlock(&c->inocache_lock);
620                                return NULL;
621                        }
622                        if (ic->state != INO_STATE_CHECKEDABSENT) {
623                                /* Wait for progress. Don't just loop */
624                                D1(printk(KERN_DEBUG "Waiting for ino #%u in state %d\n",
625                                          ic->ino, ic->state));
626                                sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock);
627                        } else {
628                                spin_unlock(&c->inocache_lock);
629                        }
630
631                        return NULL;
632                }
633        } else {
634                /* Inode has links to it still; they're not going away because
635                   jffs2_do_unlink() would need the alloc_sem and we have it.
636                   Just iget() it, and if read_inode() is necessary that's OK.
637                */
638                inode = jffs2_iget(OFNI_BS_2SFFJ(c), inum);
639                if (IS_ERR(inode))
640                        return ERR_CAST(inode);
641        }
Show full sources