Changes in uspace/srv/fs/mfs/mfs_ops.c [df3caec5:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
rdf3caec5 r9d58539 384 384 if (flags & L_DIRECTORY) { 385 385 ino_i->i_mode = S_IFDIR; 386 ino_i->i_nlinks = 2; /* This accounts for the '.' dentry */387 } else {386 ino_i->i_nlinks = 1; /* This accounts for the '.' dentry */ 387 } else 388 388 ino_i->i_mode = S_IFREG; 389 ino_i->i_nlinks = 1;390 }391 389 392 390 ino_i->i_uid = 0; … … 666 664 struct mfs_node *child = cfn->data; 667 665 struct mfs_sb_info *sbi = parent->instance->sbi; 666 bool destroy_dentry = false; 668 667 669 668 mfsdebug("%s()\n", __FUNCTION__); … … 674 673 int r = mfs_insert_dentry(parent, name, child->ino_i->index); 675 674 if (r != EOK) 676 goto exit_error;675 return r; 677 676 678 677 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 } 679 684 r = mfs_insert_dentry(child, ".", child->ino_i->index); 680 if (r != EOK) 681 goto exit_error; 685 if (r != EOK) { 686 destroy_dentry = true; 687 goto exit; 688 } 682 689 683 690 r = mfs_insert_dentry(child, "..", parent->ino_i->index); 684 if (r != EOK) 685 goto exit_error; 691 if (r != EOK) { 692 destroy_dentry = true; 693 goto exit; 694 } 686 695 687 696 parent->ino_i->i_nlinks++; … … 689 698 } 690 699 691 exit_error: 700 exit: 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 } 692 709 return r; 693 710 } … … 820 837 found: 821 838 async_data_read_finalize(callid, d_info.d_name, 822 839 str_size(d_info.d_name) + 1); 823 840 bytes = ((pos - spos) + 1); 824 841 } else {
Note:
See TracChangeset
for help on using the changeset viewer.