diff options
Diffstat (limited to 'net/sunrpc/auth_gss/svcauth_gss.c')
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 008cdade5aae..1b94a9c8a242 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -1295,34 +1295,9 @@ static int set_gss_proxy(struct net *net, int type) | |||
1295 | else | 1295 | else |
1296 | ret = -EBUSY; | 1296 | ret = -EBUSY; |
1297 | spin_unlock(&use_gssp_lock); | 1297 | spin_unlock(&use_gssp_lock); |
1298 | wake_up(&sn->gssp_wq); | ||
1299 | return ret; | 1298 | return ret; |
1300 | } | 1299 | } |
1301 | 1300 | ||
1302 | static inline bool gssp_ready(struct sunrpc_net *sn) | ||
1303 | { | ||
1304 | switch (sn->use_gss_proxy) { | ||
1305 | case -1: | ||
1306 | return false; | ||
1307 | case 0: | ||
1308 | return true; | ||
1309 | case 1: | ||
1310 | return sn->gssp_clnt; | ||
1311 | } | ||
1312 | WARN_ON_ONCE(1); | ||
1313 | return false; | ||
1314 | } | ||
1315 | |||
1316 | static int wait_for_gss_proxy(struct net *net, struct file *file) | ||
1317 | { | ||
1318 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | ||
1319 | |||
1320 | if (file->f_flags & O_NONBLOCK && !gssp_ready(sn)) | ||
1321 | return -EAGAIN; | ||
1322 | return wait_event_interruptible(sn->gssp_wq, gssp_ready(sn)); | ||
1323 | } | ||
1324 | |||
1325 | |||
1326 | static ssize_t write_gssp(struct file *file, const char __user *buf, | 1301 | static ssize_t write_gssp(struct file *file, const char __user *buf, |
1327 | size_t count, loff_t *ppos) | 1302 | size_t count, loff_t *ppos) |
1328 | { | 1303 | { |
@@ -1355,16 +1330,12 @@ static ssize_t read_gssp(struct file *file, char __user *buf, | |||
1355 | size_t count, loff_t *ppos) | 1330 | size_t count, loff_t *ppos) |
1356 | { | 1331 | { |
1357 | struct net *net = PDE_DATA(file_inode(file)); | 1332 | struct net *net = PDE_DATA(file_inode(file)); |
1333 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | ||
1358 | unsigned long p = *ppos; | 1334 | unsigned long p = *ppos; |
1359 | char tbuf[10]; | 1335 | char tbuf[10]; |
1360 | size_t len; | 1336 | size_t len; |
1361 | int ret; | ||
1362 | |||
1363 | ret = wait_for_gss_proxy(net, file); | ||
1364 | if (ret) | ||
1365 | return ret; | ||
1366 | 1337 | ||
1367 | snprintf(tbuf, sizeof(tbuf), "%d\n", use_gss_proxy(net)); | 1338 | snprintf(tbuf, sizeof(tbuf), "%d\n", sn->use_gss_proxy); |
1368 | len = strlen(tbuf); | 1339 | len = strlen(tbuf); |
1369 | if (p >= len) | 1340 | if (p >= len) |
1370 | return 0; | 1341 | return 0; |