diff options
Diffstat (limited to 'fs/nfsd/nfsctl.c')
| -rw-r--r-- | fs/nfsd/nfsctl.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 4e042105fb6e..ca73ca79a0ee 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
| @@ -49,6 +49,7 @@ enum { | |||
| 49 | NFSD_Leasetime, | 49 | NFSD_Leasetime, |
| 50 | NFSD_Gracetime, | 50 | NFSD_Gracetime, |
| 51 | NFSD_RecoveryDir, | 51 | NFSD_RecoveryDir, |
| 52 | NFSD_V4EndGrace, | ||
| 52 | #endif | 53 | #endif |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| @@ -68,6 +69,7 @@ static ssize_t write_maxconn(struct file *file, char *buf, size_t size); | |||
| 68 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size); | 69 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size); |
| 69 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size); | 70 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size); |
| 70 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); | 71 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); |
| 72 | static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size); | ||
| 71 | #endif | 73 | #endif |
| 72 | 74 | ||
| 73 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { | 75 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { |
| @@ -84,6 +86,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
| 84 | [NFSD_Leasetime] = write_leasetime, | 86 | [NFSD_Leasetime] = write_leasetime, |
| 85 | [NFSD_Gracetime] = write_gracetime, | 87 | [NFSD_Gracetime] = write_gracetime, |
| 86 | [NFSD_RecoveryDir] = write_recoverydir, | 88 | [NFSD_RecoveryDir] = write_recoverydir, |
| 89 | [NFSD_V4EndGrace] = write_v4_end_grace, | ||
| 87 | #endif | 90 | #endif |
| 88 | }; | 91 | }; |
| 89 | 92 | ||
| @@ -1077,6 +1080,47 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | |||
| 1077 | return rv; | 1080 | return rv; |
| 1078 | } | 1081 | } |
| 1079 | 1082 | ||
| 1083 | /** | ||
| 1084 | * write_v4_end_grace - release grace period for nfsd's v4.x lock manager | ||
| 1085 | * | ||
| 1086 | * Input: | ||
| 1087 | * buf: ignored | ||
| 1088 | * size: zero | ||
| 1089 | * OR | ||
| 1090 | * | ||
| 1091 | * Input: | ||
| 1092 | * buf: any value | ||
| 1093 | * size: non-zero length of C string in @buf | ||
| 1094 | * Output: | ||
| 1095 | * passed-in buffer filled with "Y" or "N" with a newline | ||
| 1096 | * and NULL-terminated C string. This indicates whether | ||
| 1097 | * the grace period has ended in the current net | ||
| 1098 | * namespace. Return code is the size in bytes of the | ||
| 1099 | * string. Writing a string that starts with 'Y', 'y', or | ||
| 1100 | * '1' to the file will end the grace period for nfsd's v4 | ||
| 1101 | * lock manager. | ||
| 1102 | */ | ||
| 1103 | static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) | ||
| 1104 | { | ||
| 1105 | struct net *net = file->f_dentry->d_sb->s_fs_info; | ||
| 1106 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
| 1107 | |||
| 1108 | if (size > 0) { | ||
| 1109 | switch(buf[0]) { | ||
| 1110 | case 'Y': | ||
| 1111 | case 'y': | ||
| 1112 | case '1': | ||
| 1113 | nfsd4_end_grace(nn); | ||
| 1114 | break; | ||
| 1115 | default: | ||
| 1116 | return -EINVAL; | ||
| 1117 | } | ||
| 1118 | } | ||
| 1119 | |||
| 1120 | return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%c\n", | ||
| 1121 | nn->grace_ended ? 'Y' : 'N'); | ||
| 1122 | } | ||
| 1123 | |||
| 1080 | #endif | 1124 | #endif |
| 1081 | 1125 | ||
| 1082 | /*----------------------------------------------------------------------------*/ | 1126 | /*----------------------------------------------------------------------------*/ |
| @@ -1110,6 +1154,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
| 1110 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, | 1154 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 1111 | [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, | 1155 | [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 1112 | [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, | 1156 | [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, |
| 1157 | [NFSD_V4EndGrace] = {"v4_end_grace", &transaction_ops, S_IWUSR|S_IRUGO}, | ||
| 1113 | #endif | 1158 | #endif |
| 1114 | /* last one */ {""} | 1159 | /* last one */ {""} |
| 1115 | }; | 1160 | }; |
