~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to fs/nfsd/vfs.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
        struct svc_export       *exp;
182
182
        struct dentry           *dparent;
183
183
        struct dentry           *dentry;
184
 
        __be32                  err;
185
184
        int                     host_err;
186
185
 
187
186
        dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
188
187
 
189
 
        /* Obtain dentry and export. */
190
 
        err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
191
 
        if (err)
192
 
                return err;
193
 
 
194
188
        dparent = fhp->fh_dentry;
195
189
        exp  = fhp->fh_export;
196
190
        exp_get(exp);
254
248
        struct dentry           *dentry;
255
249
        __be32 err;
256
250
 
 
251
        err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC);
 
252
        if (err)
 
253
                return err;
257
254
        err = nfsd_lookup_dentry(rqstp, fhp, name, len, &exp, &dentry);
258
255
        if (err)
259
256
                return err;
699
696
}
700
697
#endif /* CONFIG_NFSD_V3 */
701
698
 
 
699
static int nfsd_open_break_lease(struct inode *inode, int access)
 
700
{
 
701
        unsigned int mode;
702
702
 
 
703
        if (access & NFSD_MAY_NOT_BREAK_LEASE)
 
704
                return 0;
 
705
        mode = (access & NFSD_MAY_WRITE) ? O_WRONLY : O_RDONLY;
 
706
        return break_lease(inode, mode | O_NONBLOCK);
 
707
}
703
708
 
704
709
/*
705
710
 * Open an existing file or directory.
747
752
        if (!inode->i_fop)
748
753
                goto out;
749
754
 
750
 
        /*
751
 
         * Check to see if there are any leases on this file.
752
 
         * This may block while leases are broken.
753
 
         */
754
 
        if (!(access & NFSD_MAY_NOT_BREAK_LEASE))
755
 
                host_err = break_lease(inode, O_NONBLOCK | ((access & NFSD_MAY_WRITE) ? O_WRONLY : 0));
 
755
        host_err = nfsd_open_break_lease(inode, access);
756
756
        if (host_err) /* NOMEM or WOULDBLOCK */
757
757
                goto out_nfserr;
758
758
 
877
877
nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
878
878
              loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
879
879
{
880
 
        struct inode *inode;
881
880
        mm_segment_t    oldfs;
882
881
        __be32          err;
883
882
        int             host_err;
884
883
 
885
884
        err = nfserr_perm;
886
 
        inode = file->f_path.dentry->d_inode;
887
885
 
888
886
        if (file->f_op->splice_read && rqstp->rq_splice_ok) {
889
887
                struct splice_desc sd = {
1340
1338
}
1341
1339
 
1342
1340
#ifdef CONFIG_NFSD_V3
 
1341
 
 
1342
static inline int nfsd_create_is_exclusive(int createmode)
 
1343
{
 
1344
        return createmode == NFS3_CREATE_EXCLUSIVE
 
1345
               || createmode == NFS4_CREATE_EXCLUSIVE4_1;
 
1346
}
 
1347
 
1343
1348
/*
1344
 
 * NFSv3 version of nfsd_create
 
1349
 * NFSv3 and NFSv4 version of nfsd_create
1345
1350
 */
1346
1351
__be32
1347
 
nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
1352
do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1348
1353
                char *fname, int flen, struct iattr *iap,
1349
1354
                struct svc_fh *resfhp, int createmode, u32 *verifier,
1350
1355
                int *truncp, int *created)
1396
1401
        if (err)
1397
1402
                goto out;
1398
1403
 
1399
 
        if (createmode == NFS3_CREATE_EXCLUSIVE) {
 
1404
        if (nfsd_create_is_exclusive(createmode)) {
1400
1405
                /* solaris7 gets confused (bugid 4218508) if these have
1401
1406
                 * the high bit set, so just clear the high bits. If this is
1402
1407
                 * ever changed to use different attrs for storing the
1437
1442
                            && dchild->d_inode->i_atime.tv_sec == v_atime
1438
1443
                            && dchild->d_inode->i_size  == 0 )
1439
1444
                                break;
 
1445
                case NFS4_CREATE_EXCLUSIVE4_1:
 
1446
                        if (   dchild->d_inode->i_mtime.tv_sec == v_mtime
 
1447
                            && dchild->d_inode->i_atime.tv_sec == v_atime
 
1448
                            && dchild->d_inode->i_size  == 0 )
 
1449
                                goto set_attr;
1440
1450
                         /* fallthru */
1441
1451
                case NFS3_CREATE_GUARDED:
1442
1452
                        err = nfserr_exist;
1455
1465
 
1456
1466
        nfsd_check_ignore_resizing(iap);
1457
1467
 
1458
 
        if (createmode == NFS3_CREATE_EXCLUSIVE) {
 
1468
        if (nfsd_create_is_exclusive(createmode)) {
1459
1469
                /* Cram the verifier into atime/mtime */
1460
1470
                iap->ia_valid = ATTR_MTIME|ATTR_ATIME
1461
1471
                        | ATTR_MTIME_SET|ATTR_ATIME_SET;
1653
1663
        if (!dold->d_inode)
1654
1664
                goto out_drop_write;
1655
1665
        host_err = nfsd_break_lease(dold->d_inode);
1656
 
        if (host_err)
 
1666
        if (host_err) {
 
1667
                err = nfserrno(host_err);
1657
1668
                goto out_drop_write;
 
1669
        }
1658
1670
        host_err = vfs_link(dold, dirp, dnew);
1659
1671
        if (!host_err) {
1660
1672
                err = nfserrno(commit_metadata(ffhp));
2034
2046
        struct inode    *inode = dentry->d_inode;
2035
2047
        int             err;
2036
2048
 
2037
 
        if (acc == NFSD_MAY_NOP)
 
2049
        if ((acc & NFSD_MAY_MASK) == NFSD_MAY_NOP)
2038
2050
                return 0;
2039
2051
#if 0
2040
2052
        dprintk("nfsd: permission 0x%x%s%s%s%s%s%s%s mode 0%o%s%s%s\n",