namei.c (7eef4091a653c243a87e5375c54504cc03bec4d8) namei.c (cb25797d451dc774d9dbc402a65f16a0e32199fe)
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * namei.c
5 *
6 * Create and rename file, directory, symlinks
7 *
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.

--- 104 unchanged lines hidden (view full) ---

113 if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) {
114 ret = ERR_PTR(-ENAMETOOLONG);
115 goto bail;
116 }
117
118 mlog(0, "find name %.*s in directory %llu\n", dentry->d_name.len,
119 dentry->d_name.name, (unsigned long long)OCFS2_I(dir)->ip_blkno);
120
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * namei.c
5 *
6 * Create and rename file, directory, symlinks
7 *
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.

--- 104 unchanged lines hidden (view full) ---

113 if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) {
114 ret = ERR_PTR(-ENAMETOOLONG);
115 goto bail;
116 }
117
118 mlog(0, "find name %.*s in directory %llu\n", dentry->d_name.len,
119 dentry->d_name.name, (unsigned long long)OCFS2_I(dir)->ip_blkno);
120
121 status = ocfs2_inode_lock(dir, NULL, 0);
121 status = ocfs2_inode_lock_nested(dir, NULL, 0, OI_LS_PARENT);
122 if (status < 0) {
123 if (status != -ENOENT)
124 mlog_errno(status);
125 ret = ERR_PTR(status);
126 goto bail;
127 }
128
129 status = ocfs2_lookup_ino_from_name(dir, dentry->d_name.name,

--- 501 unchanged lines hidden (view full) ---

631
632 mlog_entry("(inode=%lu, old='%.*s' new='%.*s')\n", inode->i_ino,
633 old_dentry->d_name.len, old_dentry->d_name.name,
634 dentry->d_name.len, dentry->d_name.name);
635
636 if (S_ISDIR(inode->i_mode))
637 return -EPERM;
638
122 if (status < 0) {
123 if (status != -ENOENT)
124 mlog_errno(status);
125 ret = ERR_PTR(status);
126 goto bail;
127 }
128
129 status = ocfs2_lookup_ino_from_name(dir, dentry->d_name.name,

--- 501 unchanged lines hidden (view full) ---

631
632 mlog_entry("(inode=%lu, old='%.*s' new='%.*s')\n", inode->i_ino,
633 old_dentry->d_name.len, old_dentry->d_name.name,
634 dentry->d_name.len, dentry->d_name.name);
635
636 if (S_ISDIR(inode->i_mode))
637 return -EPERM;
638
639 err = ocfs2_inode_lock(dir, &parent_fe_bh, 1);
639 err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT);
640 if (err < 0) {
641 if (err != -ENOENT)
642 mlog_errno(err);
643 return err;
644 }
645
646 if (!dir->i_nlink) {
647 err = -ENOENT;

--- 147 unchanged lines hidden (view full) ---

795
796 mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
797
798 if (inode == osb->root_inode) {
799 mlog(0, "Cannot delete the root directory\n");
800 return -EPERM;
801 }
802
640 if (err < 0) {
641 if (err != -ENOENT)
642 mlog_errno(err);
643 return err;
644 }
645
646 if (!dir->i_nlink) {
647 err = -ENOENT;

--- 147 unchanged lines hidden (view full) ---

795
796 mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
797
798 if (inode == osb->root_inode) {
799 mlog(0, "Cannot delete the root directory\n");
800 return -EPERM;
801 }
802
803 status = ocfs2_inode_lock(dir, &parent_node_bh, 1);
803 status = ocfs2_inode_lock_nested(dir, &parent_node_bh, 1,
804 OI_LS_PARENT);
804 if (status < 0) {
805 if (status != -ENOENT)
806 mlog_errno(status);
807 return status;
808 }
809
810 status = ocfs2_find_files_on_disk(dentry->d_name.name,
811 dentry->d_name.len, &blkno, dir,

--- 161 unchanged lines hidden (view full) ---

973 bh2 = bh1;
974 bh1 = tmpbh;
975
976 tmpinode = inode2;
977 inode2 = inode1;
978 inode1 = tmpinode;
979 }
980 /* lock id2 */
805 if (status < 0) {
806 if (status != -ENOENT)
807 mlog_errno(status);
808 return status;
809 }
810
811 status = ocfs2_find_files_on_disk(dentry->d_name.name,
812 dentry->d_name.len, &blkno, dir,

--- 161 unchanged lines hidden (view full) ---

974 bh2 = bh1;
975 bh1 = tmpbh;
976
977 tmpinode = inode2;
978 inode2 = inode1;
979 inode1 = tmpinode;
980 }
981 /* lock id2 */
981 status = ocfs2_inode_lock(inode2, bh2, 1);
982 status = ocfs2_inode_lock_nested(inode2, bh2, 1,
983 OI_LS_RENAME1);
982 if (status < 0) {
983 if (status != -ENOENT)
984 mlog_errno(status);
985 goto bail;
986 }
987 }
988
989 /* lock id1 */
984 if (status < 0) {
985 if (status != -ENOENT)
986 mlog_errno(status);
987 goto bail;
988 }
989 }
990
991 /* lock id1 */
990 status = ocfs2_inode_lock(inode1, bh1, 1);
992 status = ocfs2_inode_lock_nested(inode1, bh1, 1, OI_LS_RENAME2);
991 if (status < 0) {
992 /*
993 * An error return must mean that no cluster locks
994 * were held on function exit.
995 */
996 if (oi1->ip_blkno != oi2->ip_blkno)
997 ocfs2_inode_unlock(inode2, 1);
998

--- 99 unchanged lines hidden (view full) ---

1098 }
1099
1100 /*
1101 * Aside from allowing a meta data update, the locking here
1102 * also ensures that the downconvert thread on other nodes
1103 * won't have to concurrently downconvert the inode and the
1104 * dentry locks.
1105 */
993 if (status < 0) {
994 /*
995 * An error return must mean that no cluster locks
996 * were held on function exit.
997 */
998 if (oi1->ip_blkno != oi2->ip_blkno)
999 ocfs2_inode_unlock(inode2, 1);
1000

--- 99 unchanged lines hidden (view full) ---

1100 }
1101
1102 /*
1103 * Aside from allowing a meta data update, the locking here
1104 * also ensures that the downconvert thread on other nodes
1105 * won't have to concurrently downconvert the inode and the
1106 * dentry locks.
1107 */
1106 status = ocfs2_inode_lock(old_inode, &old_inode_bh, 1);
1108 status = ocfs2_inode_lock_nested(old_inode, &old_inode_bh, 1,
1109 OI_LS_PARENT);
1107 if (status < 0) {
1108 if (status != -ENOENT)
1109 mlog_errno(status);
1110 goto bail;
1111 }
1112 old_child_locked = 1;
1113
1114 status = ocfs2_remote_dentry_delete(old_dentry);

--- 931 unchanged lines hidden ---
1110 if (status < 0) {
1111 if (status != -ENOENT)
1112 mlog_errno(status);
1113 goto bail;
1114 }
1115 old_child_locked = 1;
1116
1117 status = ocfs2_remote_dentry_delete(old_dentry);

--- 931 unchanged lines hidden ---