Opened 13 years ago

Closed 13 years ago

#288 closed defect (fixed)

fat crashes on assert(idxp->pfc) in fat_node_get_core()

Reported by: Jakub Jermář Owned by: Jakub Jermář
Priority: major Milestone: 0.4.3
Component: helenos/fs/fat Version:
Keywords: Cc:
Blocker for: Depends on:
See also:

Description

In mainline,832, the following two commands:

# rm /log/klog
# ls

will make FAT hit the following assertion in fat_node_get_core():

        /*
         * We must instantiate the node from the file system.
         */

        assert(idxp->pfc);

ls will report a problem after it printed two entries for srv and readme:

ls: skipping bogus node //drv

After switching to kconsole, we can see a message about the failed assertion and also a stack trace, from which we can see the calling sequence:

fat_node_get_core()
fat_write()

I think the role of fat_write() can be substituted also by other callers of fat_node_get_core(), such as fat_sync().

Change History (4)

comment:1 by Jakub Jermář, 13 years ago

Owner: set to Jakub Jermář
Status: newassigned

comment:2 by Jakub Jermář, 13 years ago

Status: assignedaccepted

comment:3 by Jakub Jermář, 13 years ago

I investigated the background of the:

ls: skipping bogus node //drv
rc=-3

message printed during ls. Note that the rc of -3 is ELIMIT returned by stat().

The reason for that is that stat() invokes a lookup operation, which fails at this place in _fat_block_get():

        /*
         * This function can only operate on non-zero length files.
         */
        if (fcl == FAT_CLST_RES0)
                return ELIMIT;

This is how we get to _fat_block_get():

_fat_block_get()
fat_node_sync()
fat_node_get_new()
fat_node_get_core()
fat_match()
libfs_lookup()
fat_lookup()

comment:4 by Jakub Jermář, 13 years ago

Resolution: fixed
Status: acceptedclosed

So the problem was that after unlinking the /log/klog node, its node structure was put on the node free list from where it might have been recycled for instantiating some other node. In that case, the node would be disassociated from its index structure and idx→pfc would be zeroed.

Fix merged in changeset:mainline,873.

Note: See TracTickets for help on using tickets.