Commit a8277b9baa6268de386529a33061775bc716198b

Authored by Miklos Szeredi
Committed by Al Viro
1 parent f60dc3db6e

vfs: move O_DIRECT check to common code

Perform open_check_o_direct() in a common place in do_last after opening the
file.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 5 additions and 12 deletions Side-by-side Diff

... ... @@ -2305,22 +2305,15 @@
2305 2305 * here.
2306 2306 */
2307 2307 error = may_open(&filp->f_path, acc_mode, open_flag);
2308   - if (error)
2309   - goto out_fput;
  2308 + if (error) {
  2309 + fput(filp);
  2310 + filp = ERR_PTR(error);
  2311 + }
2310 2312  
2311   - error = open_check_o_direct(filp);
2312   - if (error)
2313   - goto out_fput;
2314   -
2315 2313 out:
2316 2314 dput(dentry);
2317 2315 return filp;
2318 2316  
2319   -out_fput:
2320   - fput(filp);
2321   - filp = ERR_PTR(error);
2322   - goto out;
2323   -
2324 2317 no_open:
2325 2318 if (need_lookup) {
2326 2319 dentry = lookup_real(dir, dentry, nd);
2327 2320  
... ... @@ -2619,10 +2612,10 @@
2619 2612 goto stale_open;
2620 2613 goto out;
2621 2614 }
  2615 +opened:
2622 2616 error = open_check_o_direct(filp);
2623 2617 if (error)
2624 2618 goto exit_fput;
2625   -opened:
2626 2619 error = ima_file_check(filp, op->acc_mode);
2627 2620 if (error)
2628 2621 goto exit_fput;