Lines Matching refs:op
690 static void afs_do_lookup_success(struct afs_operation *op) in afs_do_lookup_success() argument
700 for (i = 0; i < op->nr_files; i++) { in afs_do_lookup_success()
703 vp = &op->file[0]; in afs_do_lookup_success()
706 op->ac.abort_code = abort_code; in afs_do_lookup_success()
707 op->error = afs_abort_to_error(abort_code); in afs_do_lookup_success()
712 vp = &op->file[1]; in afs_do_lookup_success()
716 vp = &op->more_files[i - 2]; in afs_do_lookup_success()
726 afs_vnode_commit_status(op, vp); in afs_do_lookup_success()
728 inode = afs_iget(op, vp); in afs_do_lookup_success()
731 afs_cache_permit(vnode, op->key, in afs_do_lookup_success()
733 op->cb_v_break, in afs_do_lookup_success()
802 struct afs_operation *op; in afs_do_lookup() local
846 op = afs_alloc_operation(NULL, dvnode->volume); in afs_do_lookup()
847 if (IS_ERR(op)) { in afs_do_lookup()
848 ret = PTR_ERR(op); in afs_do_lookup()
852 afs_op_set_vnode(op, 0, dvnode); in afs_do_lookup()
853 afs_op_set_fid(op, 1, &cookie->fids[1]); in afs_do_lookup()
855 op->nr_files = cookie->nr_fids; in afs_do_lookup()
856 _debug("nr_files %u", op->nr_files); in afs_do_lookup()
859 op->error = -ENOMEM; in afs_do_lookup()
860 if (op->nr_files > 2) { in afs_do_lookup()
861 op->more_files = kvcalloc(op->nr_files - 2, in afs_do_lookup()
864 if (!op->more_files) in afs_do_lookup()
867 for (i = 2; i < op->nr_files; i++) { in afs_do_lookup()
868 vp = &op->more_files[i - 2]; in afs_do_lookup()
891 op->error = -ENOTSUPP; in afs_do_lookup()
893 op->ops = &afs_inline_bulk_status_operation; in afs_do_lookup()
894 afs_begin_vnode_operation(op); in afs_do_lookup()
895 afs_wait_for_operation(op); in afs_do_lookup()
898 if (op->error == -ENOTSUPP) { in afs_do_lookup()
903 op->fetch_status.which = 1; in afs_do_lookup()
904 op->ops = &afs_lookup_fetch_status_operation; in afs_do_lookup()
905 afs_begin_vnode_operation(op); in afs_do_lookup()
906 afs_wait_for_operation(op); in afs_do_lookup()
908 inode = ERR_PTR(op->error); in afs_do_lookup()
911 if (op->error == 0) { in afs_do_lookup()
912 inode = &op->file[1].vnode->netfs.inode; in afs_do_lookup()
913 op->file[1].vnode = NULL; in afs_do_lookup()
916 if (op->file[0].scb.have_status) in afs_do_lookup()
917 dentry->d_fsdata = (void *)(unsigned long)op->file[0].scb.status.data_version; in afs_do_lookup()
919 dentry->d_fsdata = (void *)(unsigned long)op->file[0].dv_before; in afs_do_lookup()
920 ret = afs_put_operation(op); in afs_do_lookup()
1264 void afs_check_for_remote_deletion(struct afs_operation *op) in afs_check_for_remote_deletion() argument
1266 struct afs_vnode *vnode = op->file[0].vnode; in afs_check_for_remote_deletion()
1268 switch (op->ac.abort_code) { in afs_check_for_remote_deletion()
1278 static void afs_vnode_new_inode(struct afs_operation *op) in afs_vnode_new_inode() argument
1280 struct afs_vnode_param *vp = &op->file[1]; in afs_vnode_new_inode()
1286 ASSERTCMP(op->error, ==, 0); in afs_vnode_new_inode()
1288 inode = afs_iget(op, vp); in afs_vnode_new_inode()
1293 op->error = PTR_ERR(inode); in afs_vnode_new_inode()
1299 if (!op->error) in afs_vnode_new_inode()
1300 afs_cache_permit(vnode, op->key, vnode->cb_break, &vp->scb); in afs_vnode_new_inode()
1301 d_instantiate(op->dentry, inode); in afs_vnode_new_inode()
1304 static void afs_create_success(struct afs_operation *op) in afs_create_success() argument
1306 _enter("op=%08x", op->debug_id); in afs_create_success()
1307 op->ctime = op->file[0].scb.status.mtime_client; in afs_create_success()
1308 afs_vnode_commit_status(op, &op->file[0]); in afs_create_success()
1309 afs_update_dentry_version(op, &op->file[0], op->dentry); in afs_create_success()
1310 afs_vnode_new_inode(op); in afs_create_success()
1313 static void afs_create_edit_dir(struct afs_operation *op) in afs_create_edit_dir() argument
1315 struct afs_vnode_param *dvp = &op->file[0]; in afs_create_edit_dir()
1316 struct afs_vnode_param *vp = &op->file[1]; in afs_create_edit_dir()
1319 _enter("op=%08x", op->debug_id); in afs_create_edit_dir()
1324 afs_edit_dir_add(dvnode, &op->dentry->d_name, &vp->fid, in afs_create_edit_dir()
1325 op->create.reason); in afs_create_edit_dir()
1329 static void afs_create_put(struct afs_operation *op) in afs_create_put() argument
1331 _enter("op=%08x", op->debug_id); in afs_create_put()
1333 if (op->error) in afs_create_put()
1334 d_drop(op->dentry); in afs_create_put()
1352 struct afs_operation *op; in afs_mkdir() local
1358 op = afs_alloc_operation(NULL, dvnode->volume); in afs_mkdir()
1359 if (IS_ERR(op)) { in afs_mkdir()
1361 return PTR_ERR(op); in afs_mkdir()
1364 afs_op_set_vnode(op, 0, dvnode); in afs_mkdir()
1365 op->file[0].dv_delta = 1; in afs_mkdir()
1366 op->file[0].modification = true; in afs_mkdir()
1367 op->file[0].update_ctime = true; in afs_mkdir()
1368 op->dentry = dentry; in afs_mkdir()
1369 op->create.mode = S_IFDIR | mode; in afs_mkdir()
1370 op->create.reason = afs_edit_dir_for_mkdir; in afs_mkdir()
1371 op->mtime = current_time(dir); in afs_mkdir()
1372 op->ops = &afs_mkdir_operation; in afs_mkdir()
1373 return afs_do_sync_operation(op); in afs_mkdir()
1391 static void afs_rmdir_success(struct afs_operation *op) in afs_rmdir_success() argument
1393 _enter("op=%08x", op->debug_id); in afs_rmdir_success()
1394 op->ctime = op->file[0].scb.status.mtime_client; in afs_rmdir_success()
1395 afs_vnode_commit_status(op, &op->file[0]); in afs_rmdir_success()
1396 afs_update_dentry_version(op, &op->file[0], op->dentry); in afs_rmdir_success()
1399 static void afs_rmdir_edit_dir(struct afs_operation *op) in afs_rmdir_edit_dir() argument
1401 struct afs_vnode_param *dvp = &op->file[0]; in afs_rmdir_edit_dir()
1404 _enter("op=%08x", op->debug_id); in afs_rmdir_edit_dir()
1405 afs_dir_remove_subdir(op->dentry); in afs_rmdir_edit_dir()
1410 afs_edit_dir_remove(dvnode, &op->dentry->d_name, in afs_rmdir_edit_dir()
1415 static void afs_rmdir_put(struct afs_operation *op) in afs_rmdir_put() argument
1417 _enter("op=%08x", op->debug_id); in afs_rmdir_put()
1418 if (op->file[1].vnode) in afs_rmdir_put()
1419 up_write(&op->file[1].vnode->rmdir_lock); in afs_rmdir_put()
1436 struct afs_operation *op; in afs_rmdir() local
1443 op = afs_alloc_operation(NULL, dvnode->volume); in afs_rmdir()
1444 if (IS_ERR(op)) in afs_rmdir()
1445 return PTR_ERR(op); in afs_rmdir()
1447 afs_op_set_vnode(op, 0, dvnode); in afs_rmdir()
1448 op->file[0].dv_delta = 1; in afs_rmdir()
1449 op->file[0].modification = true; in afs_rmdir()
1450 op->file[0].update_ctime = true; in afs_rmdir()
1452 op->dentry = dentry; in afs_rmdir()
1453 op->ops = &afs_rmdir_operation; in afs_rmdir()
1458 ret = afs_validate(vnode, op->key); in afs_rmdir()
1467 op->file[1].vnode = vnode; in afs_rmdir()
1470 return afs_do_sync_operation(op); in afs_rmdir()
1473 return afs_put_operation(op); in afs_rmdir()
1486 static void afs_dir_remove_link(struct afs_operation *op) in afs_dir_remove_link() argument
1488 struct afs_vnode *dvnode = op->file[0].vnode; in afs_dir_remove_link()
1489 struct afs_vnode *vnode = op->file[1].vnode; in afs_dir_remove_link()
1490 struct dentry *dentry = op->dentry; in afs_dir_remove_link()
1493 if (op->error != 0 || in afs_dir_remove_link()
1494 (op->file[1].scb.have_status && op->file[1].scb.have_error)) in afs_dir_remove_link()
1515 ret = afs_validate(vnode, op->key); in afs_dir_remove_link()
1517 op->error = ret; in afs_dir_remove_link()
1520 _debug("nlink %d [val %d]", vnode->netfs.inode.i_nlink, op->error); in afs_dir_remove_link()
1523 static void afs_unlink_success(struct afs_operation *op) in afs_unlink_success() argument
1525 _enter("op=%08x", op->debug_id); in afs_unlink_success()
1526 op->ctime = op->file[0].scb.status.mtime_client; in afs_unlink_success()
1527 afs_check_dir_conflict(op, &op->file[0]); in afs_unlink_success()
1528 afs_vnode_commit_status(op, &op->file[0]); in afs_unlink_success()
1529 afs_vnode_commit_status(op, &op->file[1]); in afs_unlink_success()
1530 afs_update_dentry_version(op, &op->file[0], op->dentry); in afs_unlink_success()
1531 afs_dir_remove_link(op); in afs_unlink_success()
1534 static void afs_unlink_edit_dir(struct afs_operation *op) in afs_unlink_edit_dir() argument
1536 struct afs_vnode_param *dvp = &op->file[0]; in afs_unlink_edit_dir()
1539 _enter("op=%08x", op->debug_id); in afs_unlink_edit_dir()
1543 afs_edit_dir_remove(dvnode, &op->dentry->d_name, in afs_unlink_edit_dir()
1548 static void afs_unlink_put(struct afs_operation *op) in afs_unlink_put() argument
1550 _enter("op=%08x", op->debug_id); in afs_unlink_put()
1551 if (op->unlink.need_rehash && op->error < 0 && op->error != -ENOENT) in afs_unlink_put()
1552 d_rehash(op->dentry); in afs_unlink_put()
1569 struct afs_operation *op; in afs_unlink() local
1580 op = afs_alloc_operation(NULL, dvnode->volume); in afs_unlink()
1581 if (IS_ERR(op)) in afs_unlink()
1582 return PTR_ERR(op); in afs_unlink()
1584 afs_op_set_vnode(op, 0, dvnode); in afs_unlink()
1585 op->file[0].dv_delta = 1; in afs_unlink()
1586 op->file[0].modification = true; in afs_unlink()
1587 op->file[0].update_ctime = true; in afs_unlink()
1590 ret = afs_validate(vnode, op->key); in afs_unlink()
1592 op->error = ret; in afs_unlink()
1601 op->error = afs_sillyrename(dvnode, vnode, dentry, op->key); in afs_unlink()
1607 op->unlink.need_rehash = true; in afs_unlink()
1611 op->file[1].vnode = vnode; in afs_unlink()
1612 op->file[1].update_ctime = true; in afs_unlink()
1613 op->file[1].op_unlinked = true; in afs_unlink()
1614 op->dentry = dentry; in afs_unlink()
1615 op->ops = &afs_unlink_operation; in afs_unlink()
1616 afs_begin_vnode_operation(op); in afs_unlink()
1617 afs_wait_for_operation(op); in afs_unlink()
1622 if (op->error == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) { in afs_unlink()
1623 op->file[1].update_ctime = false; in afs_unlink()
1624 op->fetch_status.which = 1; in afs_unlink()
1625 op->ops = &afs_fetch_status_operation; in afs_unlink()
1626 afs_begin_vnode_operation(op); in afs_unlink()
1627 afs_wait_for_operation(op); in afs_unlink()
1630 return afs_put_operation(op); in afs_unlink()
1633 return afs_put_operation(op); in afs_unlink()
1651 struct afs_operation *op; in afs_create() local
1661 op = afs_alloc_operation(NULL, dvnode->volume); in afs_create()
1662 if (IS_ERR(op)) { in afs_create()
1663 ret = PTR_ERR(op); in afs_create()
1667 afs_op_set_vnode(op, 0, dvnode); in afs_create()
1668 op->file[0].dv_delta = 1; in afs_create()
1669 op->file[0].modification = true; in afs_create()
1670 op->file[0].update_ctime = true; in afs_create()
1672 op->dentry = dentry; in afs_create()
1673 op->create.mode = S_IFREG | mode; in afs_create()
1674 op->create.reason = afs_edit_dir_for_create; in afs_create()
1675 op->mtime = current_time(dir); in afs_create()
1676 op->ops = &afs_create_operation; in afs_create()
1677 return afs_do_sync_operation(op); in afs_create()
1685 static void afs_link_success(struct afs_operation *op) in afs_link_success() argument
1687 struct afs_vnode_param *dvp = &op->file[0]; in afs_link_success()
1688 struct afs_vnode_param *vp = &op->file[1]; in afs_link_success()
1690 _enter("op=%08x", op->debug_id); in afs_link_success()
1691 op->ctime = dvp->scb.status.mtime_client; in afs_link_success()
1692 afs_vnode_commit_status(op, dvp); in afs_link_success()
1693 afs_vnode_commit_status(op, vp); in afs_link_success()
1694 afs_update_dentry_version(op, dvp, op->dentry); in afs_link_success()
1695 if (op->dentry_2->d_parent == op->dentry->d_parent) in afs_link_success()
1696 afs_update_dentry_version(op, dvp, op->dentry_2); in afs_link_success()
1698 d_instantiate(op->dentry, &vp->vnode->netfs.inode); in afs_link_success()
1701 static void afs_link_put(struct afs_operation *op) in afs_link_put() argument
1703 _enter("op=%08x", op->debug_id); in afs_link_put()
1704 if (op->error) in afs_link_put()
1705 d_drop(op->dentry); in afs_link_put()
1723 struct afs_operation *op; in afs_link() local
1736 op = afs_alloc_operation(NULL, dvnode->volume); in afs_link()
1737 if (IS_ERR(op)) { in afs_link()
1738 ret = PTR_ERR(op); in afs_link()
1742 ret = afs_validate(vnode, op->key); in afs_link()
1746 afs_op_set_vnode(op, 0, dvnode); in afs_link()
1747 afs_op_set_vnode(op, 1, vnode); in afs_link()
1748 op->file[0].dv_delta = 1; in afs_link()
1749 op->file[0].modification = true; in afs_link()
1750 op->file[0].update_ctime = true; in afs_link()
1751 op->file[1].update_ctime = true; in afs_link()
1753 op->dentry = dentry; in afs_link()
1754 op->dentry_2 = from; in afs_link()
1755 op->ops = &afs_link_operation; in afs_link()
1756 op->create.reason = afs_edit_dir_for_link; in afs_link()
1757 return afs_do_sync_operation(op); in afs_link()
1760 afs_put_operation(op); in afs_link()
1782 struct afs_operation *op; in afs_symlink() local
1798 op = afs_alloc_operation(NULL, dvnode->volume); in afs_symlink()
1799 if (IS_ERR(op)) { in afs_symlink()
1800 ret = PTR_ERR(op); in afs_symlink()
1804 afs_op_set_vnode(op, 0, dvnode); in afs_symlink()
1805 op->file[0].dv_delta = 1; in afs_symlink()
1807 op->dentry = dentry; in afs_symlink()
1808 op->ops = &afs_symlink_operation; in afs_symlink()
1809 op->create.reason = afs_edit_dir_for_symlink; in afs_symlink()
1810 op->create.symlink = content; in afs_symlink()
1811 op->mtime = current_time(dir); in afs_symlink()
1812 return afs_do_sync_operation(op); in afs_symlink()
1820 static void afs_rename_success(struct afs_operation *op) in afs_rename_success() argument
1822 _enter("op=%08x", op->debug_id); in afs_rename_success()
1824 op->ctime = op->file[0].scb.status.mtime_client; in afs_rename_success()
1825 afs_check_dir_conflict(op, &op->file[1]); in afs_rename_success()
1826 afs_vnode_commit_status(op, &op->file[0]); in afs_rename_success()
1827 if (op->file[1].vnode != op->file[0].vnode) { in afs_rename_success()
1828 op->ctime = op->file[1].scb.status.mtime_client; in afs_rename_success()
1829 afs_vnode_commit_status(op, &op->file[1]); in afs_rename_success()
1833 static void afs_rename_edit_dir(struct afs_operation *op) in afs_rename_edit_dir() argument
1835 struct afs_vnode_param *orig_dvp = &op->file[0]; in afs_rename_edit_dir()
1836 struct afs_vnode_param *new_dvp = &op->file[1]; in afs_rename_edit_dir()
1839 struct afs_vnode *vnode = AFS_FS_I(d_inode(op->dentry)); in afs_rename_edit_dir()
1840 struct dentry *old_dentry = op->dentry; in afs_rename_edit_dir()
1841 struct dentry *new_dentry = op->dentry_2; in afs_rename_edit_dir()
1844 _enter("op=%08x", op->debug_id); in afs_rename_edit_dir()
1846 if (op->rename.rehash) { in afs_rename_edit_dir()
1847 d_rehash(op->rename.rehash); in afs_rename_edit_dir()
1848 op->rename.rehash = NULL; in afs_rename_edit_dir()
1864 if (!op->rename.new_negative) in afs_rename_edit_dir()
1888 afs_update_dentry_version(op, new_dvp, op->dentry); in afs_rename_edit_dir()
1889 afs_update_dentry_version(op, new_dvp, op->dentry_2); in afs_rename_edit_dir()
1896 static void afs_rename_put(struct afs_operation *op) in afs_rename_put() argument
1898 _enter("op=%08x", op->debug_id); in afs_rename_put()
1899 if (op->rename.rehash) in afs_rename_put()
1900 d_rehash(op->rename.rehash); in afs_rename_put()
1901 dput(op->rename.tmp); in afs_rename_put()
1902 if (op->error) in afs_rename_put()
1903 d_rehash(op->dentry); in afs_rename_put()
1921 struct afs_operation *op; in afs_rename() local
1942 op = afs_alloc_operation(NULL, orig_dvnode->volume); in afs_rename()
1943 if (IS_ERR(op)) in afs_rename()
1944 return PTR_ERR(op); in afs_rename()
1946 ret = afs_validate(vnode, op->key); in afs_rename()
1947 op->error = ret; in afs_rename()
1951 afs_op_set_vnode(op, 0, orig_dvnode); in afs_rename()
1952 afs_op_set_vnode(op, 1, new_dvnode); /* May be same as orig_dvnode */ in afs_rename()
1953 op->file[0].dv_delta = 1; in afs_rename()
1954 op->file[1].dv_delta = 1; in afs_rename()
1955 op->file[0].modification = true; in afs_rename()
1956 op->file[1].modification = true; in afs_rename()
1957 op->file[0].update_ctime = true; in afs_rename()
1958 op->file[1].update_ctime = true; in afs_rename()
1960 op->dentry = old_dentry; in afs_rename()
1961 op->dentry_2 = new_dentry; in afs_rename()
1962 op->rename.new_negative = d_is_negative(new_dentry); in afs_rename()
1963 op->ops = &afs_rename_operation; in afs_rename()
1976 op->rename.rehash = new_dentry; in afs_rename()
1981 op->rename.tmp = d_alloc(new_dentry->d_parent, in afs_rename()
1983 if (!op->rename.tmp) { in afs_rename()
1984 op->error = -ENOMEM; in afs_rename()
1990 new_dentry, op->key); in afs_rename()
1992 op->error = ret; in afs_rename()
1996 op->dentry_2 = op->rename.tmp; in afs_rename()
1997 op->rename.rehash = NULL; in afs_rename()
1998 op->rename.new_negative = true; in afs_rename()
2013 return afs_do_sync_operation(op); in afs_rename()
2016 return afs_put_operation(op); in afs_rename()