Changeset c31d773 in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2008-03-09T19:55:42Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
088cecc
Parents:
c089919
Message:

Grab the nodes_futex when manipulating node link counts in rename() and
_unlink().

Fix VFS futex definitions and declarations by replacing atomic_t by futex_t.

File:
1 edited

Legend:

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

    rc089919 rc31d773  
    5151#include <fcntl.h>
    5252#include <assert.h>
    53 #include <atomic.h>
    5453#include <vfs/canonify.h>
    5554
     
    6362RWLOCK_INITIALIZE(namespace_rwlock);
    6463
    65 atomic_t rootfs_futex = FUTEX_INITIALIZER;
     64futex_t rootfs_futex = FUTEX_INITIALIZER;
    6665vfs_triplet_t rootfs = {
    6766        .fs_handle = 0,
     
    687686         */
    688687        vfs_node_t *node = vfs_node_get(&lr);
     688        futex_down(&nodes_futex);
    689689        node->lnkcnt--;
     690        futex_up(&nodes_futex);
    690691        rwlock_write_unlock(&namespace_rwlock);
    691692        vfs_node_put(node);
     
    811812                        return;
    812813                }
     814                futex_down(&nodes_futex);
    813815                new_node->lnkcnt--;
     816                futex_up(&nodes_futex);
    814817                break;
    815818        default:
     
    831834                return;
    832835        }
     836        futex_down(&nodes_futex);
    833837        old_node->lnkcnt++;
     838        futex_up(&nodes_futex);
    834839        /* Destroy the link for the old name. */
    835840        rc = vfs_lookup_internal(oldc, L_UNLINK, NULL, NULL);
     
    844849                return;
    845850        }
     851        futex_down(&nodes_futex);
    846852        old_node->lnkcnt--;
     853        futex_up(&nodes_futex);
    847854        rwlock_write_unlock(&namespace_rwlock);
    848855        vfs_node_put(old_node);
Note: See TracChangeset for help on using the changeset viewer.