Changes in / [747ef72:54464f6a] in mainline


Ignore:
Location:
uspace
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/mfs/mfs_balloc.c

    r747ef72 r54464f6a  
    198198                limit = sbi->nzones - sbi->firstdatazone - 1;
    199199        } else {
    200                 /*bid == BMAP_INODE*/
     200                /* bid == BMAP_INODE */
    201201                search = &sbi->isearch;
    202202                start_block = 2;
     
    212212        for (i = *search / bits_per_block; i < nblocks; ++i) {
    213213                r = block_get(&b, inst->service_id, i + start_block,
    214                               BLOCK_FLAGS_NONE);
     214                    BLOCK_FLAGS_NONE);
    215215
    216216                if (r != EOK)
  • uspace/srv/fs/mfs/mfs_dentry.c

    r747ef72 r54464f6a  
    168168                return ENAMETOOLONG;
    169169
    170         /*Search the directory entry to be removed*/
     170        /* Search the directory entry to be removed */
    171171        unsigned i;
    172172        for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize ; ++i) {
  • uspace/srv/fs/mfs/mfs_inode.c

    r747ef72 r54464f6a  
    235235
    236236        r = block_get(&b, mnode->instance->service_id,
    237                       itable_off + inum / sbi->ino_per_block,
    238                       BLOCK_FLAGS_NONE);
     237            itable_off + inum / sbi->ino_per_block,
     238            BLOCK_FLAGS_NONE);
    239239
    240240        if (r != EOK)
     
    278278
    279279        r = block_get(&b, mnode->instance->service_id,
    280                       itable_off + inum / sbi->ino_per_block,
    281                       BLOCK_FLAGS_NONE);
     280            itable_off + inum / sbi->ino_per_block,
     281            BLOCK_FLAGS_NONE);
    282282
    283283        if (r != EOK)
  • uspace/srv/fs/mfs/mfs_ops.c

    r747ef72 r54464f6a  
    664664        struct mfs_node *child = cfn->data;
    665665        struct mfs_sb_info *sbi = parent->instance->sbi;
     666        bool destroy_dentry = false;
    666667
    667668        mfsdebug("%s()\n", __FUNCTION__);
     
    672673        int r = mfs_insert_dentry(parent, name, child->ino_i->index);
    673674        if (r != EOK)
    674                 goto exit_error;
    675 
    676         child->ino_i->i_nlinks++;
    677         child->ino_i->dirty = true;
     675                return r;
    678676
    679677        if (S_ISDIR(child->ino_i->i_mode)) {
     678                if (child->ino_i->i_nlinks != 1) {
     679                        /* It's not possible to hardlink directories in MFS */
     680                        destroy_dentry = true;
     681                        r = EMLINK;
     682                        goto exit;
     683                }
    680684                r = mfs_insert_dentry(child, ".", child->ino_i->index);
    681                 if (r != EOK)
    682                         goto exit_error;
     685                if (r != EOK) {
     686                        destroy_dentry = true;
     687                        goto exit;
     688                }
    683689
    684690                r = mfs_insert_dentry(child, "..", parent->ino_i->index);
    685                 if (r != EOK)
    686                         goto exit_error;
     691                if (r != EOK) {
     692                        destroy_dentry = true;
     693                        goto exit;
     694                }
    687695
    688696                parent->ino_i->i_nlinks++;
     
    690698        }
    691699
    692 exit_error:
     700exit:
     701        if (destroy_dentry) {
     702                int r2 = mfs_remove_dentry(parent, name);
     703                if (r2 != EOK)
     704                        r = r2;
     705        } else {
     706                child->ino_i->i_nlinks++;
     707                child->ino_i->dirty = true;
     708        }
    693709        return r;
    694710}
     
    821837found:
    822838                async_data_read_finalize(callid, d_info.d_name,
    823                                         str_size(d_info.d_name) + 1);
     839                    str_size(d_info.d_name) + 1);
    824840                bytes = ((pos - spos) + 1);
    825841        } else {
Note: See TracChangeset for help on using the changeset viewer.