aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-05-07 21:24:47 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-11-03 15:21:11 -0500
commit48eddfd5ca591d2bd97594afd58cffa6b5a48ef4 (patch)
tree97eada0ec16e98c46a101c8b407a4b47c506a215
parent946e51f2bf37f1656916eb75bd0742ba33983c28 (diff)
lustre: switch ll_intent_file_open() to struct dentry *
... because fake struct file is wrong. ll_prep_inode() in there is an atrocity - despite passing a pointer to inode by address, it actually only uses the value when that value is non-NULL, as it will be here. Oh, and ->d_parent of anything is never NULL. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/staging/lustre/lustre/llite/file.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index c99b74117152..382b53a8ce62 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -394,21 +394,19 @@ int ll_file_release(struct inode *inode, struct file *file)
394 return rc; 394 return rc;
395} 395}
396 396
397static int ll_intent_file_open(struct file *file, void *lmm, 397static int ll_intent_file_open(struct dentry *dentry, void *lmm,
398 int lmmsize, struct lookup_intent *itp) 398 int lmmsize, struct lookup_intent *itp)
399{ 399{
400 struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode); 400 struct inode *inode = dentry->d_inode;
401 struct dentry *parent = file->f_dentry->d_parent; 401 struct ll_sb_info *sbi = ll_i2sbi(inode);
402 const char *name = file->f_dentry->d_name.name; 402 struct dentry *parent = dentry->d_parent;
403 const int len = file->f_dentry->d_name.len; 403 const char *name = dentry->d_name.name;
404 const int len = dentry->d_name.len;
404 struct md_op_data *op_data; 405 struct md_op_data *op_data;
405 struct ptlrpc_request *req; 406 struct ptlrpc_request *req;
406 __u32 opc = LUSTRE_OPC_ANY; 407 __u32 opc = LUSTRE_OPC_ANY;
407 int rc; 408 int rc;
408 409
409 if (!parent)
410 return -ENOENT;
411
412 /* Usually we come here only for NFSD, and we want open lock. 410 /* Usually we come here only for NFSD, and we want open lock.
413 But we can also get here with pre 2.6.15 patchless kernels, and in 411 But we can also get here with pre 2.6.15 patchless kernels, and in
414 that case that lock is also ok */ 412 that case that lock is also ok */
@@ -425,7 +423,7 @@ static int ll_intent_file_open(struct file *file, void *lmm,
425 } 423 }
426 424
427 op_data = ll_prep_md_op_data(NULL, parent->d_inode, 425 op_data = ll_prep_md_op_data(NULL, parent->d_inode,
428 file->f_dentry->d_inode, name, len, 426 inode, name, len,
429 O_RDWR, opc, NULL); 427 O_RDWR, opc, NULL);
430 if (IS_ERR(op_data)) 428 if (IS_ERR(op_data))
431 return PTR_ERR(op_data); 429 return PTR_ERR(op_data);
@@ -441,7 +439,7 @@ static int ll_intent_file_open(struct file *file, void *lmm,
441 if (!it_disposition(itp, DISP_OPEN_OPEN) || 439 if (!it_disposition(itp, DISP_OPEN_OPEN) ||
442 it_open_error(DISP_OPEN_OPEN, itp)) 440 it_open_error(DISP_OPEN_OPEN, itp))
443 goto out; 441 goto out;
444 ll_release_openhandle(file->f_dentry, itp); 442 ll_release_openhandle(dentry, itp);
445 goto out; 443 goto out;
446 } 444 }
447 445
@@ -456,10 +454,9 @@ static int ll_intent_file_open(struct file *file, void *lmm,
456 goto out; 454 goto out;
457 } 455 }
458 456
459 rc = ll_prep_inode(&file->f_dentry->d_inode, req, NULL, itp); 457 rc = ll_prep_inode(&inode, req, NULL, itp);
460 if (!rc && itp->d.lustre.it_lock_mode) 458 if (!rc && itp->d.lustre.it_lock_mode)
461 ll_set_lock_data(sbi->ll_md_exp, file->f_dentry->d_inode, 459 ll_set_lock_data(sbi->ll_md_exp, inode, itp, NULL);
462 itp, NULL);
463 460
464out: 461out:
465 ptlrpc_req_finished(req); 462 ptlrpc_req_finished(req);
@@ -652,7 +649,7 @@ restart:
652 result in a deadlock */ 649 result in a deadlock */
653 mutex_unlock(&lli->lli_och_mutex); 650 mutex_unlock(&lli->lli_och_mutex);
654 it->it_create_mode |= M_CHECK_STALE; 651 it->it_create_mode |= M_CHECK_STALE;
655 rc = ll_intent_file_open(file, NULL, 0, it); 652 rc = ll_intent_file_open(file->f_path.dentry, NULL, 0, it);
656 it->it_create_mode &= ~M_CHECK_STALE; 653 it->it_create_mode &= ~M_CHECK_STALE;
657 if (rc) 654 if (rc)
658 goto out_openerr; 655 goto out_openerr;
@@ -1371,7 +1368,7 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
1371 } 1368 }
1372 1369
1373 ll_inode_size_lock(inode); 1370 ll_inode_size_lock(inode);
1374 rc = ll_intent_file_open(file, lum, lum_size, &oit); 1371 rc = ll_intent_file_open(file->f_path.dentry, lum, lum_size, &oit);
1375 if (rc) 1372 if (rc)
1376 goto out_unlock; 1373 goto out_unlock;
1377 rc = oit.d.lustre.it_status; 1374 rc = oit.d.lustre.it_status;