diff options
Diffstat (limited to 'fs/nfsd')
| -rw-r--r-- | fs/nfsd/nfs4state.c | 3 | ||||
| -rw-r--r-- | fs/nfsd/nfs4xdr.c | 14 | ||||
| -rw-r--r-- | fs/nfsd/nfsctl.c | 65 |
3 files changed, 65 insertions, 17 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 55dfdd71f1b0..8799b8708188 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -2712,9 +2712,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 2712 | * Note: locks.c uses the BKL to protect the inode's lock list. | 2712 | * Note: locks.c uses the BKL to protect the inode's lock list. |
| 2713 | */ | 2713 | */ |
| 2714 | 2714 | ||
| 2715 | /* XXX?: Just to divert the locks_release_private at the start of | ||
| 2716 | * locks_copy_lock: */ | ||
| 2717 | locks_init_lock(&conflock); | ||
| 2718 | err = vfs_lock_file(filp, cmd, &file_lock, &conflock); | 2715 | err = vfs_lock_file(filp, cmd, &file_lock, &conflock); |
| 2719 | switch (-err) { | 2716 | switch (-err) { |
| 2720 | case 0: /* success! */ | 2717 | case 0: /* success! */ |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 1ba7ad981935..c513bbdf2d36 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -376,20 +376,6 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
| 376 | goto xdr_error; | 376 | goto xdr_error; |
| 377 | } | 377 | } |
| 378 | } | 378 | } |
| 379 | if (bmval[1] & FATTR4_WORD1_TIME_METADATA) { | ||
| 380 | /* We require the high 32 bits of 'seconds' to be 0, and we ignore | ||
| 381 | all 32 bits of 'nseconds'. */ | ||
| 382 | READ_BUF(12); | ||
| 383 | len += 12; | ||
| 384 | READ32(dummy32); | ||
| 385 | if (dummy32) | ||
| 386 | return nfserr_inval; | ||
| 387 | READ32(iattr->ia_ctime.tv_sec); | ||
| 388 | READ32(iattr->ia_ctime.tv_nsec); | ||
| 389 | if (iattr->ia_ctime.tv_nsec >= (u32)1000000000) | ||
| 390 | return nfserr_inval; | ||
| 391 | iattr->ia_valid |= ATTR_CTIME; | ||
| 392 | } | ||
| 393 | if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { | 379 | if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { |
| 394 | READ_BUF(4); | 380 | READ_BUF(4); |
| 395 | len += 4; | 381 | len += 4; |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 613bcb8171a5..42f3820ee8f5 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
| 23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
| 24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
| 25 | #include <linux/inet.h> | ||
| 25 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 26 | #include <linux/smp_lock.h> | 27 | #include <linux/smp_lock.h> |
| 27 | #include <linux/ctype.h> | 28 | #include <linux/ctype.h> |
| @@ -35,6 +36,7 @@ | |||
| 35 | #include <linux/nfsd/cache.h> | 36 | #include <linux/nfsd/cache.h> |
| 36 | #include <linux/nfsd/xdr.h> | 37 | #include <linux/nfsd/xdr.h> |
| 37 | #include <linux/nfsd/syscall.h> | 38 | #include <linux/nfsd/syscall.h> |
| 39 | #include <linux/lockd/lockd.h> | ||
| 38 | 40 | ||
| 39 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
| 40 | #include <net/ipv6.h> | 42 | #include <net/ipv6.h> |
| @@ -53,6 +55,8 @@ enum { | |||
| 53 | NFSD_Getfs, | 55 | NFSD_Getfs, |
| 54 | NFSD_List, | 56 | NFSD_List, |
| 55 | NFSD_Fh, | 57 | NFSD_Fh, |
| 58 | NFSD_FO_UnlockIP, | ||
| 59 | NFSD_FO_UnlockFS, | ||
| 56 | NFSD_Threads, | 60 | NFSD_Threads, |
| 57 | NFSD_Pool_Threads, | 61 | NFSD_Pool_Threads, |
| 58 | NFSD_Versions, | 62 | NFSD_Versions, |
| @@ -89,6 +93,9 @@ static ssize_t write_leasetime(struct file *file, char *buf, size_t size); | |||
| 89 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); | 93 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); |
| 90 | #endif | 94 | #endif |
| 91 | 95 | ||
| 96 | static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size); | ||
| 97 | static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size); | ||
| 98 | |||
| 92 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { | 99 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { |
| 93 | [NFSD_Svc] = write_svc, | 100 | [NFSD_Svc] = write_svc, |
| 94 | [NFSD_Add] = write_add, | 101 | [NFSD_Add] = write_add, |
| @@ -98,6 +105,8 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
| 98 | [NFSD_Getfd] = write_getfd, | 105 | [NFSD_Getfd] = write_getfd, |
| 99 | [NFSD_Getfs] = write_getfs, | 106 | [NFSD_Getfs] = write_getfs, |
| 100 | [NFSD_Fh] = write_filehandle, | 107 | [NFSD_Fh] = write_filehandle, |
| 108 | [NFSD_FO_UnlockIP] = failover_unlock_ip, | ||
| 109 | [NFSD_FO_UnlockFS] = failover_unlock_fs, | ||
| 101 | [NFSD_Threads] = write_threads, | 110 | [NFSD_Threads] = write_threads, |
| 102 | [NFSD_Pool_Threads] = write_pool_threads, | 111 | [NFSD_Pool_Threads] = write_pool_threads, |
| 103 | [NFSD_Versions] = write_versions, | 112 | [NFSD_Versions] = write_versions, |
| @@ -298,6 +307,58 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size) | |||
| 298 | return err; | 307 | return err; |
| 299 | } | 308 | } |
| 300 | 309 | ||
| 310 | static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size) | ||
| 311 | { | ||
| 312 | __be32 server_ip; | ||
| 313 | char *fo_path, c; | ||
| 314 | int b1, b2, b3, b4; | ||
| 315 | |||
| 316 | /* sanity check */ | ||
| 317 | if (size == 0) | ||
| 318 | return -EINVAL; | ||
| 319 | |||
| 320 | if (buf[size-1] != '\n') | ||
| 321 | return -EINVAL; | ||
| 322 | |||
| 323 | fo_path = buf; | ||
| 324 | if (qword_get(&buf, fo_path, size) < 0) | ||
| 325 | return -EINVAL; | ||
| 326 | |||
| 327 | /* get ipv4 address */ | ||
| 328 | if (sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4) | ||
| 329 | return -EINVAL; | ||
| 330 | server_ip = htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); | ||
| 331 | |||
| 332 | return nlmsvc_unlock_all_by_ip(server_ip); | ||
| 333 | } | ||
| 334 | |||
| 335 | static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size) | ||
| 336 | { | ||
| 337 | struct nameidata nd; | ||
| 338 | char *fo_path; | ||
| 339 | int error; | ||
| 340 | |||
| 341 | /* sanity check */ | ||
| 342 | if (size == 0) | ||
| 343 | return -EINVAL; | ||
| 344 | |||
| 345 | if (buf[size-1] != '\n') | ||
| 346 | return -EINVAL; | ||
| 347 | |||
| 348 | fo_path = buf; | ||
| 349 | if (qword_get(&buf, fo_path, size) < 0) | ||
| 350 | return -EINVAL; | ||
| 351 | |||
| 352 | error = path_lookup(fo_path, 0, &nd); | ||
| 353 | if (error) | ||
| 354 | return error; | ||
| 355 | |||
| 356 | error = nlmsvc_unlock_all_by_sb(nd.path.mnt->mnt_sb); | ||
| 357 | |||
| 358 | path_put(&nd.path); | ||
| 359 | return error; | ||
| 360 | } | ||
| 361 | |||
| 301 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size) | 362 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size) |
| 302 | { | 363 | { |
| 303 | /* request is: | 364 | /* request is: |
| @@ -700,6 +761,10 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
| 700 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, | 761 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 701 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, | 762 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 702 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, | 763 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, |
| 764 | [NFSD_FO_UnlockIP] = {"unlock_ip", | ||
| 765 | &transaction_ops, S_IWUSR|S_IRUSR}, | ||
| 766 | [NFSD_FO_UnlockFS] = {"unlock_filesystem", | ||
| 767 | &transaction_ops, S_IWUSR|S_IRUSR}, | ||
| 703 | [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, | 768 | [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 704 | [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, | 769 | [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 705 | [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, | 770 | [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, |
