Commit 30062bd1 authored by David Howells's avatar David Howells

afs: Implement YFS support in the fs client

Implement support for talking to YFS-variant fileservers in the cache
manager and the filesystem client.  These implement upgraded services on
the same port as their AFS services.

YFS fileservers provide expanded capabilities over AFS.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent d4936803
...@@ -33,7 +33,8 @@ kafs-y := \ ...@@ -33,7 +33,8 @@ kafs-y := \
vl_list.o \ vl_list.o \
volume.o \ volume.o \
write.o \ write.o \
xattr.o xattr.o \
yfsclient.o
kafs-$(CONFIG_PROC_FS) += proc.o kafs-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_AFS_FS) := kafs.o obj-$(CONFIG_AFS_FS) := kafs.o
...@@ -210,12 +210,10 @@ void afs_init_callback_state(struct afs_server *server) ...@@ -210,12 +210,10 @@ void afs_init_callback_state(struct afs_server *server)
/* /*
* actually break a callback * actually break a callback
*/ */
void afs_break_callback(struct afs_vnode *vnode) void __afs_break_callback(struct afs_vnode *vnode)
{ {
_enter(""); _enter("");
write_seqlock(&vnode->cb_lock);
clear_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags); clear_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
if (test_and_clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { if (test_and_clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
vnode->cb_break++; vnode->cb_break++;
...@@ -230,7 +228,12 @@ void afs_break_callback(struct afs_vnode *vnode) ...@@ -230,7 +228,12 @@ void afs_break_callback(struct afs_vnode *vnode)
afs_lock_may_be_available(vnode); afs_lock_may_be_available(vnode);
spin_unlock(&vnode->lock); spin_unlock(&vnode->lock);
} }
}
void afs_break_callback(struct afs_vnode *vnode)
{
write_seqlock(&vnode->cb_lock);
__afs_break_callback(vnode);
write_sequnlock(&vnode->cb_lock); write_sequnlock(&vnode->cb_lock);
} }
......
...@@ -1200,7 +1200,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -1200,7 +1200,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
if (afs_begin_vnode_operation(&fc, dvnode, key)) { if (afs_begin_vnode_operation(&fc, dvnode, key)) {
while (afs_select_fileserver(&fc)) { while (afs_select_fileserver(&fc)) {
fc.cb_break = afs_calc_vnode_cb_break(dvnode); fc.cb_break = afs_calc_vnode_cb_break(dvnode);
afs_fs_remove(&fc, dentry->d_name.name, true, afs_fs_remove(&fc, vnode, dentry->d_name.name, true,
data_version); data_version);
} }
...@@ -1245,7 +1245,9 @@ static int afs_dir_remove_link(struct dentry *dentry, struct key *key, ...@@ -1245,7 +1245,9 @@ static int afs_dir_remove_link(struct dentry *dentry, struct key *key,
if (d_really_is_positive(dentry)) { if (d_really_is_positive(dentry)) {
struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));
if (dir_valid) { if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
/* Already done */
} else if (dir_valid) {
drop_nlink(&vnode->vfs_inode); drop_nlink(&vnode->vfs_inode);
if (vnode->vfs_inode.i_nlink == 0) { if (vnode->vfs_inode.i_nlink == 0) {
set_bit(AFS_VNODE_DELETED, &vnode->flags); set_bit(AFS_VNODE_DELETED, &vnode->flags);
...@@ -1274,7 +1276,7 @@ static int afs_dir_remove_link(struct dentry *dentry, struct key *key, ...@@ -1274,7 +1276,7 @@ static int afs_dir_remove_link(struct dentry *dentry, struct key *key,
static int afs_unlink(struct inode *dir, struct dentry *dentry) static int afs_unlink(struct inode *dir, struct dentry *dentry)
{ {
struct afs_fs_cursor fc; struct afs_fs_cursor fc;
struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode; struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL;
struct key *key; struct key *key;
unsigned long d_version = (unsigned long)dentry->d_fsdata; unsigned long d_version = (unsigned long)dentry->d_fsdata;
u64 data_version = dvnode->status.data_version; u64 data_version = dvnode->status.data_version;
...@@ -1304,7 +1306,18 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1304,7 +1306,18 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
if (afs_begin_vnode_operation(&fc, dvnode, key)) { if (afs_begin_vnode_operation(&fc, dvnode, key)) {
while (afs_select_fileserver(&fc)) { while (afs_select_fileserver(&fc)) {
fc.cb_break = afs_calc_vnode_cb_break(dvnode); fc.cb_break = afs_calc_vnode_cb_break(dvnode);
afs_fs_remove(&fc, dentry->d_name.name, false,
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc.cbi->server->flags) &&
!test_bit(AFS_SERVER_FL_NO_RM2, &fc.cbi->server->flags)) {
yfs_fs_remove_file2(&fc, vnode, dentry->d_name.name,
data_version);
if (fc.ac.error != -ECONNABORTED ||
fc.ac.abort_code != RXGEN_OPCODE)
continue;
set_bit(AFS_SERVER_FL_NO_RM2, &fc.cbi->server->flags);
}
afs_fs_remove(&fc, vnode, dentry->d_name.name, false,
data_version); data_version);
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "internal.h" #include "internal.h"
#include "afs_fs.h" #include "afs_fs.h"
#include "xdr_fs.h" #include "xdr_fs.h"
#include "protocol_yfs.h"
static const struct afs_fid afs_zero_fid; static const struct afs_fid afs_zero_fid;
...@@ -312,14 +313,18 @@ static void xdr_decode_AFSVolSync(const __be32 **_bp, ...@@ -312,14 +313,18 @@ static void xdr_decode_AFSVolSync(const __be32 **_bp,
struct afs_volsync *volsync) struct afs_volsync *volsync)
{ {
const __be32 *bp = *_bp; const __be32 *bp = *_bp;
u32 creation;
volsync->creation = ntohl(*bp++); creation = ntohl(*bp++);
bp++; /* spare2 */ bp++; /* spare2 */
bp++; /* spare3 */ bp++; /* spare3 */
bp++; /* spare4 */ bp++; /* spare4 */
bp++; /* spare5 */ bp++; /* spare5 */
bp++; /* spare6 */ bp++; /* spare6 */
*_bp = bp; *_bp = bp;
if (volsync)
volsync->creation = creation;
} }
/* /*
...@@ -380,6 +385,8 @@ static void xdr_decode_AFSFetchVolumeStatus(const __be32 **_bp, ...@@ -380,6 +385,8 @@ static void xdr_decode_AFSFetchVolumeStatus(const __be32 **_bp,
vs->blocks_in_use = ntohl(*bp++); vs->blocks_in_use = ntohl(*bp++);
vs->part_blocks_avail = ntohl(*bp++); vs->part_blocks_avail = ntohl(*bp++);
vs->part_max_blocks = ntohl(*bp++); vs->part_max_blocks = ntohl(*bp++);
vs->vol_copy_date = 0;
vs->vol_backup_date = 0;
*_bp = bp; *_bp = bp;
} }
...@@ -405,8 +412,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) ...@@ -405,8 +412,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call)
if (ret < 0) if (ret < 0)
return ret; return ret;
xdr_decode_AFSCallBack(call, vnode, &bp); xdr_decode_AFSCallBack(call, vnode, &bp);
if (call->reply[1]) xdr_decode_AFSVolSync(&bp, call->reply[1]);
xdr_decode_AFSVolSync(&bp, call->reply[1]);
_leave(" = 0 [done]"); _leave(" = 0 [done]");
return 0; return 0;
...@@ -433,6 +439,9 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy ...@@ -433,6 +439,9 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(vnode);
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_fetch_file_status(fc, volsync, new_inode);
_enter(",%x,{%llx:%llu},,", _enter(",%x,{%llx:%llu},,",
key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode); key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
...@@ -567,8 +576,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) ...@@ -567,8 +576,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
if (ret < 0) if (ret < 0)
return ret; return ret;
xdr_decode_AFSCallBack(call, vnode, &bp); xdr_decode_AFSCallBack(call, vnode, &bp);
if (call->reply[1]) xdr_decode_AFSVolSync(&bp, call->reply[1]);
xdr_decode_AFSVolSync(&bp, call->reply[1]);
call->unmarshall++; call->unmarshall++;
...@@ -665,6 +673,9 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) ...@@ -665,6 +673,9 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(vnode);
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_fetch_data(fc, req);
if (upper_32_bits(req->pos) || if (upper_32_bits(req->pos) ||
upper_32_bits(req->len) || upper_32_bits(req->len) ||
upper_32_bits(req->pos + req->len)) upper_32_bits(req->pos + req->len))
...@@ -765,6 +776,15 @@ int afs_fs_create(struct afs_fs_cursor *fc, ...@@ -765,6 +776,15 @@ int afs_fs_create(struct afs_fs_cursor *fc,
size_t namesz, reqsz, padsz; size_t namesz, reqsz, padsz;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)){
if (S_ISDIR(mode))
return yfs_fs_make_dir(fc, name, mode, current_data_version,
newfid, newstatus, newcb);
else
return yfs_fs_create_file(fc, name, mode, current_data_version,
newfid, newstatus, newcb);
}
_enter(""); _enter("");
namesz = strlen(name); namesz = strlen(name);
...@@ -857,15 +877,18 @@ static const struct afs_call_type afs_RXFSRemoveDir = { ...@@ -857,15 +877,18 @@ static const struct afs_call_type afs_RXFSRemoveDir = {
/* /*
* remove a file or directory * remove a file or directory
*/ */
int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir, int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
u64 current_data_version) const char *name, bool isdir, u64 current_data_version)
{ {
struct afs_vnode *vnode = fc->vnode; struct afs_vnode *dvnode = fc->vnode;
struct afs_call *call; struct afs_call *call;
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(dvnode);
size_t namesz, reqsz, padsz; size_t namesz, reqsz, padsz;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_remove(fc, vnode, name, isdir, current_data_version);
_enter(""); _enter("");
namesz = strlen(name); namesz = strlen(name);
...@@ -879,15 +902,16 @@ int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir, ...@@ -879,15 +902,16 @@ int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir,
return -ENOMEM; return -ENOMEM;
call->key = fc->key; call->key = fc->key;
call->reply[0] = vnode; call->reply[0] = dvnode;
call->reply[1] = vnode;
call->expected_version = current_data_version + 1; call->expected_version = current_data_version + 1;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
*bp++ = htonl(isdir ? FSREMOVEDIR : FSREMOVEFILE); *bp++ = htonl(isdir ? FSREMOVEDIR : FSREMOVEFILE);
*bp++ = htonl(vnode->fid.vid); *bp++ = htonl(dvnode->fid.vid);
*bp++ = htonl(vnode->fid.vnode); *bp++ = htonl(dvnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique); *bp++ = htonl(dvnode->fid.unique);
*bp++ = htonl(namesz); *bp++ = htonl(namesz);
memcpy(bp, name, namesz); memcpy(bp, name, namesz);
bp = (void *) bp + namesz; bp = (void *) bp + namesz;
...@@ -897,7 +921,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir, ...@@ -897,7 +921,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir,
} }
afs_use_fs_server(call, fc->cbi); afs_use_fs_server(call, fc->cbi);
trace_afs_make_fs_call(call, &vnode->fid); trace_afs_make_fs_call(call, &dvnode->fid);
return afs_make_call(&fc->ac, call, GFP_NOFS, false); return afs_make_call(&fc->ac, call, GFP_NOFS, false);
} }
...@@ -953,6 +977,9 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, ...@@ -953,6 +977,9 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
size_t namesz, reqsz, padsz; size_t namesz, reqsz, padsz;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_link(fc, vnode, name, current_data_version);
_enter(""); _enter("");
namesz = strlen(name); namesz = strlen(name);
...@@ -1047,6 +1074,10 @@ int afs_fs_symlink(struct afs_fs_cursor *fc, ...@@ -1047,6 +1074,10 @@ int afs_fs_symlink(struct afs_fs_cursor *fc,
size_t namesz, reqsz, padsz, c_namesz, c_padsz; size_t namesz, reqsz, padsz, c_namesz, c_padsz;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_symlink(fc, name, contents, current_data_version,
newfid, newstatus);
_enter(""); _enter("");
namesz = strlen(name); namesz = strlen(name);
...@@ -1159,6 +1190,12 @@ int afs_fs_rename(struct afs_fs_cursor *fc, ...@@ -1159,6 +1190,12 @@ int afs_fs_rename(struct afs_fs_cursor *fc,
size_t reqsz, o_namesz, o_padsz, n_namesz, n_padsz; size_t reqsz, o_namesz, o_padsz, n_namesz, n_padsz;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_rename(fc, orig_name,
new_dvnode, new_name,
current_orig_data_version,
current_new_data_version);
_enter(""); _enter("");
o_namesz = strlen(orig_name); o_namesz = strlen(orig_name);
...@@ -1329,6 +1366,9 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping, ...@@ -1329,6 +1366,9 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
loff_t size, pos, i_size; loff_t size, pos, i_size;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_store_data(fc, mapping, first, last, offset, to);
_enter(",%x,{%llx:%llu},,", _enter(",%x,{%llx:%llu},,",
key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode); key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
...@@ -1544,6 +1584,9 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr) ...@@ -1544,6 +1584,9 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(vnode);
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_setattr(fc, attr);
if (attr->ia_valid & ATTR_SIZE) if (attr->ia_valid & ATTR_SIZE)
return afs_fs_setattr_size(fc, attr); return afs_fs_setattr_size(fc, attr);
...@@ -1728,6 +1771,9 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc, ...@@ -1728,6 +1771,9 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc,
__be32 *bp; __be32 *bp;
void *tmpbuf; void *tmpbuf;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_get_volume_status(fc, vs);
_enter(""); _enter("");
tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL); tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL);
...@@ -1817,6 +1863,9 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type) ...@@ -1817,6 +1863,9 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(vnode);
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_set_lock(fc, type);
_enter(""); _enter("");
call = afs_alloc_flat_call(net, &afs_RXFSSetLock, 5 * 4, 6 * 4); call = afs_alloc_flat_call(net, &afs_RXFSSetLock, 5 * 4, 6 * 4);
...@@ -1849,6 +1898,9 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc) ...@@ -1849,6 +1898,9 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc)
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(vnode);
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_extend_lock(fc);
_enter(""); _enter("");
call = afs_alloc_flat_call(net, &afs_RXFSExtendLock, 4 * 4, 6 * 4); call = afs_alloc_flat_call(net, &afs_RXFSExtendLock, 4 * 4, 6 * 4);
...@@ -1880,6 +1932,9 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc) ...@@ -1880,6 +1932,9 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc)
struct afs_net *net = afs_v2net(vnode); struct afs_net *net = afs_v2net(vnode);
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_release_lock(fc);
_enter(""); _enter("");
call = afs_alloc_flat_call(net, &afs_RXFSReleaseLock, 4 * 4, 6 * 4); call = afs_alloc_flat_call(net, &afs_RXFSReleaseLock, 4 * 4, 6 * 4);
...@@ -1951,6 +2006,7 @@ int afs_fs_give_up_all_callbacks(struct afs_net *net, ...@@ -1951,6 +2006,7 @@ int afs_fs_give_up_all_callbacks(struct afs_net *net,
*/ */
static int afs_deliver_fs_get_capabilities(struct afs_call *call) static int afs_deliver_fs_get_capabilities(struct afs_call *call)
{ {
struct afs_server *server = call->reply[0];
u32 count; u32 count;
int ret; int ret;
...@@ -1986,6 +2042,11 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call) ...@@ -1986,6 +2042,11 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
break; break;
} }
if (call->service_id == YFS_FS_SERVICE)
set_bit(AFS_SERVER_FL_IS_YFS, &server->flags);
else
clear_bit(AFS_SERVER_FL_IS_YFS, &server->flags);
_leave(" = 0 [done]"); _leave(" = 0 [done]");
return 0; return 0;
} }
...@@ -2019,6 +2080,8 @@ int afs_fs_get_capabilities(struct afs_net *net, ...@@ -2019,6 +2080,8 @@ int afs_fs_get_capabilities(struct afs_net *net,
return -ENOMEM; return -ENOMEM;
call->key = key; call->key = key;
call->reply[0] = server;
call->upgrade = true;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
...@@ -2054,8 +2117,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call) ...@@ -2054,8 +2117,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call)
if (ret < 0) if (ret < 0)
return ret; return ret;
xdr_decode_AFSCallBack_raw(call, &bp, callback); xdr_decode_AFSCallBack_raw(call, &bp, callback);
if (volsync) xdr_decode_AFSVolSync(&bp, volsync);
xdr_decode_AFSVolSync(&bp, volsync);
_leave(" = 0 [done]"); _leave(" = 0 [done]");
return 0; return 0;
...@@ -2084,6 +2146,9 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc, ...@@ -2084,6 +2146,9 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc,
struct afs_call *call; struct afs_call *call;
__be32 *bp; __be32 *bp;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_fetch_status(fc, net, fid, status, callback, volsync);
_enter(",%x,{%llx:%llu},,", _enter(",%x,{%llx:%llu},,",
key_serial(fc->key), fid->vid, fid->vnode); key_serial(fc->key), fid->vid, fid->vnode);
...@@ -2218,8 +2283,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) ...@@ -2218,8 +2283,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
return ret; return ret;
bp = call->buffer; bp = call->buffer;
if (call->reply[3]) xdr_decode_AFSVolSync(&bp, call->reply[3]);
xdr_decode_AFSVolSync(&bp, call->reply[3]);
call->unmarshall++; call->unmarshall++;
...@@ -2256,6 +2320,10 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc, ...@@ -2256,6 +2320,10 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
__be32 *bp; __be32 *bp;
int i; int i;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
return yfs_fs_inline_bulk_status(fc, net, fids, statuses, callbacks,
nr_fids, volsync);
_enter(",%x,{%llx:%llu},%u", _enter(",%x,{%llx:%llu},%u",
key_serial(fc->key), fids[0].vid, fids[1].vnode, nr_fids); key_serial(fc->key), fids[0].vid, fids[1].vnode, nr_fids);
......
...@@ -459,6 +459,8 @@ struct afs_server { ...@@ -459,6 +459,8 @@ struct afs_server {
#define AFS_SERVER_FL_PROBING 6 /* Fileserver is being probed */ #define AFS_SERVER_FL_PROBING 6 /* Fileserver is being probed */
#define AFS_SERVER_FL_NO_IBULK 7 /* Fileserver doesn't support FS.InlineBulkStatus */ #define AFS_SERVER_FL_NO_IBULK 7 /* Fileserver doesn't support FS.InlineBulkStatus */
#define AFS_SERVER_FL_MAY_HAVE_CB 8 /* May have callbacks on this fileserver */ #define AFS_SERVER_FL_MAY_HAVE_CB 8 /* May have callbacks on this fileserver */
#define AFS_SERVER_FL_IS_YFS 9 /* Server is YFS not AFS */
#define AFS_SERVER_FL_NO_RM2 10 /* Fileserver doesn't support YFS.RemoveFile2 */
atomic_t usage; atomic_t usage;
u32 addr_version; /* Address list version */ u32 addr_version; /* Address list version */
...@@ -751,6 +753,7 @@ extern struct fscache_cookie_def afs_vnode_cache_index_def; ...@@ -751,6 +753,7 @@ extern struct fscache_cookie_def afs_vnode_cache_index_def;
* callback.c * callback.c
*/ */
extern void afs_init_callback_state(struct afs_server *); extern void afs_init_callback_state(struct afs_server *);
extern void __afs_break_callback(struct afs_vnode *);
extern void afs_break_callback(struct afs_vnode *); extern void afs_break_callback(struct afs_vnode *);
extern void afs_break_callbacks(struct afs_server *, size_t, struct afs_callback_break*); extern void afs_break_callbacks(struct afs_server *, size_t, struct afs_callback_break*);
...@@ -864,7 +867,7 @@ extern int afs_fs_give_up_callbacks(struct afs_net *, struct afs_server *); ...@@ -864,7 +867,7 @@ extern int afs_fs_give_up_callbacks(struct afs_net *, struct afs_server *);
extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *); extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *);
extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t, u64, extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t, u64,
struct afs_fid *, struct afs_file_status *, struct afs_callback *); struct afs_fid *, struct afs_file_status *, struct afs_callback *);
extern int afs_fs_remove(struct afs_fs_cursor *, const char *, bool, u64); extern int afs_fs_remove(struct afs_fs_cursor *, struct afs_vnode *, const char *, bool, u64);
extern int afs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64); extern int afs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
extern int afs_fs_symlink(struct afs_fs_cursor *, const char *, const char *, u64, extern int afs_fs_symlink(struct afs_fs_cursor *, const char *, const char *, u64,
struct afs_fid *, struct afs_file_status *); struct afs_fid *, struct afs_file_status *);
...@@ -1228,6 +1231,36 @@ extern int afs_launder_page(struct page *); ...@@ -1228,6 +1231,36 @@ extern int afs_launder_page(struct page *);
extern const struct xattr_handler *afs_xattr_handlers[]; extern const struct xattr_handler *afs_xattr_handlers[];
extern ssize_t afs_listxattr(struct dentry *, char *, size_t); extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
/*
* yfsclient.c
*/
extern int yfs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_volsync *, bool);
extern int yfs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *);
extern int yfs_fs_create_file(struct afs_fs_cursor *, const char *, umode_t, u64,
struct afs_fid *, struct afs_file_status *, struct afs_callback *);
extern int yfs_fs_make_dir(struct afs_fs_cursor *, const char *, umode_t, u64,
struct afs_fid *, struct afs_file_status *, struct afs_callback *);
extern int yfs_fs_remove_file2(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
extern int yfs_fs_remove(struct afs_fs_cursor *, struct afs_vnode *, const char *, bool, u64);
extern int yfs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
extern int yfs_fs_symlink(struct afs_fs_cursor *, const char *, const char *, u64,
struct afs_fid *, struct afs_file_status *);
extern int yfs_fs_rename(struct afs_fs_cursor *, const char *,
struct afs_vnode *, const char *, u64, u64);
extern int yfs_fs_store_data(struct afs_fs_cursor *, struct address_space *,
pgoff_t, pgoff_t, unsigned, unsigned);
extern int yfs_fs_setattr(struct afs_fs_cursor *, struct iattr *);
extern int yfs_fs_get_volume_status(struct afs_fs_cursor *, struct afs_volume_status *);
extern int yfs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t);
extern int yfs_fs_extend_lock(struct afs_fs_cursor *);
extern int yfs_fs_release_lock(struct afs_fs_cursor *);
extern int yfs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
struct afs_fid *, struct afs_file_status *,
struct afs_callback *, struct afs_volsync *);
extern int yfs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
struct afs_fid *, struct afs_file_status *,
struct afs_callback *, unsigned int,
struct afs_volsync *);
/* /*
* Miscellaneous inline functions. * Miscellaneous inline functions.
......
...@@ -30,6 +30,36 @@ enum YFS_CM_Operations { ...@@ -30,6 +30,36 @@ enum YFS_CM_Operations {
YFSCBCallBack = 64204, YFSCBCallBack = 64204,
}; };
enum YFS_FS_Operations {
YFSFETCHACL = 64131, /* YFS Fetch file ACL */
YFSFETCHSTATUS = 64132, /* YFS Fetch file status */
YFSSTOREACL = 64134, /* YFS Store file ACL */
YFSSTORESTATUS = 64135, /* YFS Store file status */
YFSREMOVEFILE = 64136, /* YFS Remove a file */
YFSCREATEFILE = 64137, /* YFS Create a file */
YFSRENAME = 64138, /* YFS Rename or move a file or directory */
YFSSYMLINK = 64139, /* YFS Create a symbolic link */
YFSLINK = 64140, /* YFS Create a hard link */
YFSMAKEDIR = 64141, /* YFS Create a directory */
YFSREMOVEDIR = 64142, /* YFS Remove a directory */
YFSGETVOLUMESTATUS = 64149, /* YFS Get volume status information */
YFSSETVOLUMESTATUS = 64150, /* YFS Set volume status information */
YFSSETLOCK = 64156, /* YFS Request a file lock */
YFSEXTENDLOCK = 64157, /* YFS Extend a file lock */
YFSRELEASELOCK = 64158, /* YFS Release a file lock */
YFSLOOKUP = 64161, /* YFS lookup file in directory */
YFSFLUSHCPS = 64165,
YFSFETCHOPAQUEACL = 64168,
YFSWHOAMI = 64170,
YFSREMOVEACL = 64171,
YFSREMOVEFILE2 = 64173,
YFSSTOREOPAQUEACL2 = 64174,
YFSINLINEBULKSTATUS = 64536, /* YFS Fetch multiple file statuses with errors */
YFSFETCHDATA64 = 64537, /* YFS Fetch file data */
YFSSTOREDATA64 = 64538, /* YFS Store file data */
YFSUPDATESYMLINK = 64540,
};
struct yfs_xdr_u64 { struct yfs_xdr_u64 {
__be32 msw; __be32 msw;
__be32 lsw; __be32 lsw;
...@@ -55,3 +85,79 @@ struct yfs_xdr_YFSFid { ...@@ -55,3 +85,79 @@ struct yfs_xdr_YFSFid {
struct yfs_xdr_u64 volume; struct yfs_xdr_u64 volume;
struct yfs_xdr_vnode vnode; struct yfs_xdr_vnode vnode;
} __packed; } __packed;
struct yfs_xdr_YFSFetchStatus {
__be32 type;
__be32 nlink;
struct yfs_xdr_u64 size;
struct yfs_xdr_u64 data_version;
struct yfs_xdr_u64 author;
struct yfs_xdr_u64 owner;
struct yfs_xdr_u64 group;
__be32 mode;
__be32 caller_access;
__be32 anon_access;
struct yfs_xdr_vnode parent;
__be32 data_access_protocol;
struct yfs_xdr_u64 mtime_client;
struct yfs_xdr_u64 mtime_server;
__be32 lock_count;
__be32 abort_code;
} __packed;
struct yfs_xdr_YFSCallBack {
__be32 version;
struct yfs_xdr_u64 expiration_time;
__be32 type;
} __packed;
struct yfs_xdr_YFSStoreStatus {
__be32 mask;
__be32 mode;
struct yfs_xdr_u64 mtime_client;
struct yfs_xdr_u64 owner;
struct yfs_xdr_u64 group;
} __packed;
struct yfs_xdr_RPCFlags {
__be32 rpc_flags;
} __packed;
struct yfs_xdr_YFSVolSync {
struct yfs_xdr_u64 vol_creation_date;
struct yfs_xdr_u64 vol_update_date;
struct yfs_xdr_u64 max_quota;
struct yfs_xdr_u64 blocks_in_use;
struct yfs_xdr_u64 blocks_avail;
} __packed;
enum yfs_volume_type {
yfs_volume_type_ro = 0,
yfs_volume_type_rw = 1,
};
#define yfs_FVSOnline 0x1
#define yfs_FVSInservice 0x2
#define yfs_FVSBlessed 0x4
#define yfs_FVSNeedsSalvage 0x8
struct yfs_xdr_YFSFetchVolumeStatus {
struct yfs_xdr_u64 vid;
struct yfs_xdr_u64 parent_id;
__be32 flags;
__be32 type;
struct yfs_xdr_u64 max_quota;
struct yfs_xdr_u64 blocks_in_use;
struct yfs_xdr_u64 part_blocks_avail;
struct yfs_xdr_u64 part_max_blocks;
struct yfs_xdr_u64 vol_copy_date;
struct yfs_xdr_u64 vol_backup_date;
} __packed;
struct yfs_xdr_YFSStoreVolumeStatus {
__be32 mask;
struct yfs_xdr_u64 min_quota;
struct yfs_xdr_u64 max_quota;
struct yfs_xdr_u64 file_quota;
} __packed;
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "afs_fs.h" #include "afs_fs.h"
#include "internal.h" #include "internal.h"
#include "protocol_yfs.h"
static unsigned afs_server_gc_delay = 10; /* Server record timeout in seconds */ static unsigned afs_server_gc_delay = 10; /* Server record timeout in seconds */
static unsigned afs_server_update_delay = 30; /* Time till VLDB recheck in secs */ static unsigned afs_server_update_delay = 30; /* Time till VLDB recheck in secs */
...@@ -513,6 +514,8 @@ void afs_purge_servers(struct afs_net *net) ...@@ -513,6 +514,8 @@ void afs_purge_servers(struct afs_net *net)
*/ */
static bool afs_do_probe_fileserver(struct afs_fs_cursor *fc) static bool afs_do_probe_fileserver(struct afs_fs_cursor *fc)
{ {
int i;
_enter(""); _enter("");
fc->ac.addr = NULL; fc->ac.addr = NULL;
...@@ -526,6 +529,11 @@ static bool afs_do_probe_fileserver(struct afs_fs_cursor *fc) ...@@ -526,6 +529,11 @@ static bool afs_do_probe_fileserver(struct afs_fs_cursor *fc)
&fc->ac, fc->key); &fc->ac, fc->key);
switch (fc->ac.error) { switch (fc->ac.error) {
case 0: case 0:
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) {
for (i = 0; i < fc->ac.alist->nr_addrs; i++)
fc->ac.alist->addrs[i].srx_service =
YFS_FS_SERVICE;
}
afs_end_cursor(&fc->ac); afs_end_cursor(&fc->ac);
set_bit(AFS_SERVER_FL_PROBED, &fc->cbi->server->flags); set_bit(AFS_SERVER_FL_PROBED, &fc->cbi->server->flags);
return true; return true;
......
This diff is collapsed.
...@@ -54,6 +54,35 @@ enum afs_fs_operation { ...@@ -54,6 +54,35 @@ enum afs_fs_operation {
afs_FS_StoreData64 = 65538, /* AFS Store file data */ afs_FS_StoreData64 = 65538, /* AFS Store file data */
afs_FS_GiveUpAllCallBacks = 65539, /* AFS Give up all our callbacks on a server */ afs_FS_GiveUpAllCallBacks = 65539, /* AFS Give up all our callbacks on a server */
afs_FS_GetCapabilities = 65540, /* AFS Get FS server capabilities */ afs_FS_GetCapabilities = 65540, /* AFS Get FS server capabilities */
yfs_FS_FetchData = 130, /* YFS Fetch file data */
yfs_FS_FetchACL = 64131, /* YFS Fetch file ACL */
yfs_FS_FetchStatus = 64132, /* YFS Fetch file status */
yfs_FS_StoreACL = 64134, /* YFS Store file ACL */
yfs_FS_StoreStatus = 64135, /* YFS Store file status */
yfs_FS_RemoveFile = 64136, /* YFS Remove a file */
yfs_FS_CreateFile = 64137, /* YFS Create a file */
yfs_FS_Rename = 64138, /* YFS Rename or move a file or directory */
yfs_FS_Symlink = 64139, /* YFS Create a symbolic link */
yfs_FS_Link = 64140, /* YFS Create a hard link */
yfs_FS_MakeDir = 64141, /* YFS Create a directory */
yfs_FS_RemoveDir = 64142, /* YFS Remove a directory */
yfs_FS_GetVolumeStatus = 64149, /* YFS Get volume status information */
yfs_FS_SetVolumeStatus = 64150, /* YFS Set volume status information */
yfs_FS_SetLock = 64156, /* YFS Request a file lock */
yfs_FS_ExtendLock = 64157, /* YFS Extend a file lock */
yfs_FS_ReleaseLock = 64158, /* YFS Release a file lock */
yfs_FS_Lookup = 64161, /* YFS lookup file in directory */
yfs_FS_FlushCPS = 64165,
yfs_FS_FetchOpaqueACL = 64168,
yfs_FS_WhoAmI = 64170,
yfs_FS_RemoveACL = 64171,
yfs_FS_RemoveFile2 = 64173,
yfs_FS_StoreOpaqueACL2 = 64174,
yfs_FS_InlineBulkStatus = 64536, /* YFS Fetch multiple file statuses with errors */
yfs_FS_FetchData64 = 64537, /* YFS Fetch file data */
yfs_FS_StoreData64 = 64538, /* YFS Store file data */
yfs_FS_UpdateSymlink = 64540,
}; };
enum afs_vl_operation { enum afs_vl_operation {
...@@ -156,7 +185,34 @@ enum afs_file_error { ...@@ -156,7 +185,34 @@ enum afs_file_error {
EM(afs_FS_FetchData64, "FS.FetchData64") \ EM(afs_FS_FetchData64, "FS.FetchData64") \
EM(afs_FS_StoreData64, "FS.StoreData64") \ EM(afs_FS_StoreData64, "FS.StoreData64") \
EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \ EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \
E_(afs_FS_GetCapabilities, "FS.GetCapabilities") EM(afs_FS_GetCapabilities, "FS.GetCapabilities") \
EM(yfs_FS_FetchACL, "YFS.FetchACL") \
EM(yfs_FS_FetchStatus, "YFS.FetchStatus") \
EM(yfs_FS_StoreACL, "YFS.StoreACL") \
EM(yfs_FS_StoreStatus, "YFS.StoreStatus") \
EM(yfs_FS_RemoveFile, "YFS.RemoveFile") \
EM(yfs_FS_CreateFile, "YFS.CreateFile") \
EM(yfs_FS_Rename, "YFS.Rename") \
EM(yfs_FS_Symlink, "YFS.Symlink") \
EM(yfs_FS_Link, "YFS.Link") \
EM(yfs_FS_MakeDir, "YFS.MakeDir") \
EM(yfs_FS_RemoveDir, "YFS.RemoveDir") \
EM(yfs_FS_GetVolumeStatus, "YFS.GetVolumeStatus") \
EM(yfs_FS_SetVolumeStatus, "YFS.SetVolumeStatus") \
EM(yfs_FS_SetLock, "YFS.SetLock") \
EM(yfs_FS_ExtendLock, "YFS.ExtendLock") \
EM(yfs_FS_ReleaseLock, "YFS.ReleaseLock") \
EM(yfs_FS_Lookup, "YFS.Lookup") \
EM(yfs_FS_FlushCPS, "YFS.FlushCPS") \
EM(yfs_FS_FetchOpaqueACL, "YFS.FetchOpaqueACL") \
EM(yfs_FS_WhoAmI, "YFS.WhoAmI") \
EM(yfs_FS_RemoveACL, "YFS.RemoveACL") \
EM(yfs_FS_RemoveFile2, "YFS.RemoveFile2") \
EM(yfs_FS_StoreOpaqueACL2, "YFS.StoreOpaqueACL2") \
EM(yfs_FS_InlineBulkStatus, "YFS.InlineBulkStatus") \
EM(yfs_FS_FetchData64, "YFS.FetchData64") \
EM(yfs_FS_StoreData64, "YFS.StoreData64") \
E_(yfs_FS_UpdateSymlink, "YFS.UpdateSymlink")
#define afs_vl_operations \ #define afs_vl_operations \
EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \ EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment