aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r--fs/udf/namei.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 7578fae12d3c..082409cd4b8a 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -142,7 +142,7 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
142} 142}
143 143
144static struct fileIdentDesc *udf_find_entry(struct inode *dir, 144static struct fileIdentDesc *udf_find_entry(struct inode *dir,
145 struct dentry *dentry, 145 struct qstr *child,
146 struct udf_fileident_bh *fibh, 146 struct udf_fileident_bh *fibh,
147 struct fileIdentDesc *cfi) 147 struct fileIdentDesc *cfi)
148{ 148{
@@ -159,8 +159,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
159 sector_t offset; 159 sector_t offset;
160 struct extent_position epos = {}; 160 struct extent_position epos = {};
161 struct udf_inode_info *dinfo = UDF_I(dir); 161 struct udf_inode_info *dinfo = UDF_I(dir);
162 int isdotdot = dentry->d_name.len == 2 && 162 int isdotdot = child->len == 2 &&
163 dentry->d_name.name[0] == '.' && dentry->d_name.name[1] == '.'; 163 child->name[0] == '.' && child->name[1] == '.';
164 164
165 size = udf_ext0_offset(dir) + dir->i_size; 165 size = udf_ext0_offset(dir) + dir->i_size;
166 f_pos = udf_ext0_offset(dir); 166 f_pos = udf_ext0_offset(dir);
@@ -238,8 +238,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
238 continue; 238 continue;
239 239
240 flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi); 240 flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
241 if (flen && udf_match(flen, fname, dentry->d_name.len, 241 if (flen && udf_match(flen, fname, child->len, child->name))
242 dentry->d_name.name))
243 goto out_ok; 242 goto out_ok;
244 } 243 }
245 244
@@ -283,7 +282,7 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry,
283 } else 282 } else
284#endif /* UDF_RECOVERY */ 283#endif /* UDF_RECOVERY */
285 284
286 if (udf_find_entry(dir, dentry, &fibh, &cfi)) { 285 if (udf_find_entry(dir, &dentry->d_name, &fibh, &cfi)) {
287 if (fibh.sbh != fibh.ebh) 286 if (fibh.sbh != fibh.ebh)
288 brelse(fibh.ebh); 287 brelse(fibh.ebh);
289 brelse(fibh.sbh); 288 brelse(fibh.sbh);
@@ -783,7 +782,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
783 782
784 retval = -ENOENT; 783 retval = -ENOENT;
785 lock_kernel(); 784 lock_kernel();
786 fi = udf_find_entry(dir, dentry, &fibh, &cfi); 785 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
787 if (!fi) 786 if (!fi)
788 goto out; 787 goto out;
789 788
@@ -829,7 +828,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
829 828
830 retval = -ENOENT; 829 retval = -ENOENT;
831 lock_kernel(); 830 lock_kernel();
832 fi = udf_find_entry(dir, dentry, &fibh, &cfi); 831 fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
833 if (!fi) 832 if (!fi)
834 goto out; 833 goto out;
835 834
@@ -1113,7 +1112,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1113 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1112 struct udf_inode_info *old_iinfo = UDF_I(old_inode);
1114 1113
1115 lock_kernel(); 1114 lock_kernel();
1116 ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi); 1115 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
1117 if (ofi) { 1116 if (ofi) {
1118 if (ofibh.sbh != ofibh.ebh) 1117 if (ofibh.sbh != ofibh.ebh)
1119 brelse(ofibh.ebh); 1118 brelse(ofibh.ebh);
@@ -1124,7 +1123,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1124 != old_inode->i_ino) 1123 != old_inode->i_ino)
1125 goto end_rename; 1124 goto end_rename;
1126 1125
1127 nfi = udf_find_entry(new_dir, new_dentry, &nfibh, &ncfi); 1126 nfi = udf_find_entry(new_dir, &new_dentry->d_name, &nfibh, &ncfi);
1128 if (nfi) { 1127 if (nfi) {
1129 if (!new_inode) { 1128 if (!new_inode) {
1130 if (nfibh.sbh != nfibh.ebh) 1129 if (nfibh.sbh != nfibh.ebh)
@@ -1192,7 +1191,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1192 udf_write_fi(new_dir, &ncfi, nfi, &nfibh, NULL, NULL); 1191 udf_write_fi(new_dir, &ncfi, nfi, &nfibh, NULL, NULL);
1193 1192
1194 /* The old fid may have moved - find it again */ 1193 /* The old fid may have moved - find it again */
1195 ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi); 1194 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
1196 udf_delete_entry(old_dir, ofi, &ofibh, &ocfi); 1195 udf_delete_entry(old_dir, ofi, &ofibh, &ocfi);
1197 1196
1198 if (new_inode) { 1197 if (new_inode) {
@@ -1244,13 +1243,10 @@ end_rename:
1244static struct dentry *udf_get_parent(struct dentry *child) 1243static struct dentry *udf_get_parent(struct dentry *child)
1245{ 1244{
1246 struct inode *inode = NULL; 1245 struct inode *inode = NULL;
1247 struct dentry dotdot; 1246 struct qstr dotdot = {.name = "..", .len = 2};
1248 struct fileIdentDesc cfi; 1247 struct fileIdentDesc cfi;
1249 struct udf_fileident_bh fibh; 1248 struct udf_fileident_bh fibh;
1250 1249
1251 dotdot.d_name.name = "..";
1252 dotdot.d_name.len = 2;
1253
1254 lock_kernel(); 1250 lock_kernel();
1255 if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) 1251 if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi))
1256 goto out_unlock; 1252 goto out_unlock;