Changeset 2c2e0c6 in mainline for uspace/srv/vfs/vfs_mount.c


Ignore:
Timestamp:
2007-09-28T20:40:56Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
af0ff9b2
Parents:
7313e7a
Message:

VFS work.
Prevent race conditions when checking rootfs by taking a newly introduced
rootfs_futex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_mount.c

    r7313e7a r2c2e0c6  
    4646#include "vfs.h"
    4747
     48atomic_t rootfs_futex = FUTEX_INITIALIZER;
    4849vfs_node_t rootfs = { 0 };
    4950
     
    5960        };
    6061
    61         return vfs_lookup_internal("/", 1, root, &altroot);
     62        return vfs_lookup_internal("/", strlen("/"), root, &altroot);
    6263}
    6364
     
    150151         */
    151152        vfs_node_t mp;
     153        futex_down(&rootfs_futex);
    152154        if (rootfs.fs_handle) {
    153155                /*
     
    160162                         * The lookup failed for some reason.
    161163                         */
     164                        futex_up(&rootfs_futex);
    162165                        free(buf);
    163166                        ipc_answer_fast(rid, rc, 0, 0);
     
    168171                 * We still don't have the root file system mounted.
    169172                 */
    170                 if ((size - FS_NAME_MAXLEN == 1) &&
     173                if ((size - FS_NAME_MAXLEN == strlen("/")) &&
    171174                    (buf[FS_NAME_MAXLEN] == '/')) {
    172175                        /*
     
    174177                         */
    175178                        rootfs = mounted_root;
     179                        futex_up(&rootfs_futex);
    176180                        free(buf);
    177181                        ipc_answer_fast(rid, EOK, 0, 0);
     
    182186                         * being mounted first.
    183187                         */
     188                        futex_up(&rootfs_futex);
    184189                        free(buf);
    185190                        ipc_answer_fast(rid, ENOENT, 0, 0);
     
    187192                }
    188193        }
    189                
     194        futex_up(&rootfs_futex);
     195       
    190196        /*
    191197         * At this point, we have all necessary pieces: file system and device
Note: See TracChangeset for help on using the changeset viewer.