Changeset 7aaed09 in mainline for uspace/srv/fs/mfs/mfs_ops.c


Ignore:
Timestamp:
2011-12-18T14:02:30Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c868e2d
Parents:
3b71e84d (diff), 1761268 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r3b71e84d r7aaed09  
    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.