Lines Matching refs:dip
447 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name) in gfs2_lookup_simple() argument
452 inode = gfs2_lookupi(dip, &qstr, 1); in gfs2_lookup_simple()
484 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_lookupi() local
500 if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) { in gfs2_lookupi()
501 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); in gfs2_lookupi()
666 static int create_ok(struct gfs2_inode *dip, const struct qstr *name, in create_ok() argument
671 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); in create_ok()
676 if (!dip->i_inode.i_nlink) in create_ok()
679 error = gfs2_dir_check(&dip->i_inode, name, NULL); in create_ok()
690 if (dip->i_entries == (u32)-1) in create_ok()
692 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1) in create_ok()
698 static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, in munge_mode_uid_gid() argument
701 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && in munge_mode_uid_gid()
702 (dip->i_inode.i_mode & S_ISUID) && dip->i_inode.i_uid) { in munge_mode_uid_gid()
705 else if (dip->i_inode.i_uid != current_fsuid()) in munge_mode_uid_gid()
707 *uid = dip->i_inode.i_uid; in munge_mode_uid_gid()
711 if (dip->i_inode.i_mode & S_ISGID) { in munge_mode_uid_gid()
714 *gid = dip->i_inode.i_gid; in munge_mode_uid_gid()
719 static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation) in alloc_dinode() argument
721 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in alloc_dinode()
724 if (gfs2_alloc_get(dip) == NULL) in alloc_dinode()
727 dip->i_alloc->al_requested = RES_DINODE; in alloc_dinode()
728 error = gfs2_inplace_reserve(dip); in alloc_dinode()
736 *no_addr = gfs2_alloc_di(dip, generation); in alloc_dinode()
741 gfs2_inplace_release(dip); in alloc_dinode()
743 gfs2_alloc_put(dip); in alloc_dinode()
758 static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, in init_dinode() argument
763 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in init_dinode()
790 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) || in init_dinode()
794 di->di_flags |= cpu_to_be32(dip->i_diskflags & in init_dinode()
817 static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, in make_dinode() argument
821 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in make_dinode()
825 munge_mode_uid_gid(dip, &mode, &uid, &gid); in make_dinode()
826 if (!gfs2_alloc_get(dip)) in make_dinode()
829 error = gfs2_quota_lock(dip, uid, gid); in make_dinode()
833 error = gfs2_quota_check(dip, uid, gid); in make_dinode()
841 init_dinode(dip, gl, inum, mode, uid, gid, generation, dev, bhp); in make_dinode()
842 gfs2_quota_change(dip, +1, uid, gid); in make_dinode()
846 gfs2_quota_unlock(dip); in make_dinode()
848 gfs2_alloc_put(dip); in make_dinode()
852 static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, in link_dinode() argument
855 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in link_dinode()
861 al = gfs2_alloc_get(dip); in link_dinode()
865 error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); in link_dinode()
869 error = alloc_required = gfs2_diradd_alloc_required(&dip->i_inode, name); in link_dinode()
873 error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid); in link_dinode()
879 error = gfs2_inplace_reserve(dip); in link_dinode()
895 error = gfs2_dir_add(&dip->i_inode, name, ip, IF2DT(ip->i_inode.i_mode)); in link_dinode()
912 if (dip->i_alloc->al_rgd) in link_dinode()
913 gfs2_inplace_release(dip); in link_dinode()
916 gfs2_quota_unlock(dip); in link_dinode()
919 gfs2_alloc_put(dip); in link_dinode()
923 static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip) in gfs2_security_init() argument
931 err = security_inode_init_security(&ip->i_inode, &dip->i_inode, in gfs2_security_init()
976 struct gfs2_inode *dip = ghs->gh_gl->gl_object; in gfs2_createi() local
977 struct inode *dir = &dip->i_inode; in gfs2_createi()
978 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in gfs2_createi()
992 error = create_ok(dip, name, mode); in gfs2_createi()
1000 error = alloc_dinode(dip, &inum.no_addr, &generation); in gfs2_createi()
1009 error = make_dinode(dip, ghs[1].gh_gl, mode, &inum, &generation, dev, &bh); in gfs2_createi()
1023 error = gfs2_acl_create(dip, GFS2_I(inode)); in gfs2_createi()
1027 error = gfs2_security_init(dip, GFS2_I(inode)); in gfs2_createi()
1031 error = link_dinode(dip, name, GFS2_I(inode)); in gfs2_createi()
1062 int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, in gfs2_rmdiri() argument
1074 error = gfs2_dir_del(dip, name); in gfs2_rmdiri()
1078 error = gfs2_change_nlink(dip, -1); in gfs2_rmdiri()
1115 int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, in gfs2_unlink_ok() argument
1123 if ((dip->i_inode.i_mode & S_ISVTX) && in gfs2_unlink_ok()
1124 dip->i_inode.i_uid != current_fsuid() && in gfs2_unlink_ok()
1128 if (IS_APPEND(&dip->i_inode)) in gfs2_unlink_ok()
1131 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); in gfs2_unlink_ok()
1135 error = gfs2_dir_check(&dip->i_inode, name, ip); in gfs2_unlink_ok()