Lines Matching refs:dip
264 struct inode *gfs2_lookup_simple(struct inode *dip, const char *name) in gfs2_lookup_simple() argument
269 inode = gfs2_lookupi(dip, &qstr, 1); in gfs2_lookup_simple()
301 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_lookupi() local
317 if (gfs2_glock_is_locked_by_me(dip->i_gl) == NULL) { in gfs2_lookupi()
318 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); in gfs2_lookupi()
349 static int create_ok(struct gfs2_inode *dip, const struct qstr *name, in create_ok() argument
354 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); in create_ok()
359 if (!dip->i_inode.i_nlink) in create_ok()
362 if (dip->i_entries == (u32)-1) in create_ok()
364 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1) in create_ok()
370 static void munge_mode_uid_gid(const struct gfs2_inode *dip, in munge_mode_uid_gid() argument
373 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && in munge_mode_uid_gid()
374 (dip->i_inode.i_mode & S_ISUID) && in munge_mode_uid_gid()
375 !uid_eq(dip->i_inode.i_uid, GLOBAL_ROOT_UID)) { in munge_mode_uid_gid()
378 else if (!uid_eq(dip->i_inode.i_uid, current_fsuid())) in munge_mode_uid_gid()
380 inode->i_uid = dip->i_inode.i_uid; in munge_mode_uid_gid()
384 if (dip->i_inode.i_mode & S_ISGID) { in munge_mode_uid_gid()
387 inode->i_gid = dip->i_inode.i_gid; in munge_mode_uid_gid()
478 static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip, in init_dinode() argument
500 gfs2_init_dir(dibh, dip); in init_dinode()
525 static unsigned gfs2_trans_da_blks(const struct gfs2_inode *dip, in gfs2_trans_da_blks() argument
529 return da->nr_blocks + gfs2_rg_blocks(dip, da->nr_blocks) + in gfs2_trans_da_blks()
533 static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, in link_dinode() argument
536 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in link_dinode()
541 error = gfs2_quota_lock_check(dip, &ap); in link_dinode()
545 error = gfs2_inplace_reserve(dip, &ap); in link_dinode()
549 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, da, 2), 0); in link_dinode()
558 error = gfs2_dir_add(&dip->i_inode, name, ip, da); in link_dinode()
562 gfs2_inplace_release(dip); in link_dinode()
564 gfs2_quota_unlock(dip); in link_dinode()
606 struct gfs2_inode *dip = GFS2_I(dir), *ip; in gfs2_create_inode() local
607 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in gfs2_create_inode()
617 error = gfs2_qa_get(dip); in gfs2_create_inode()
625 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); in gfs2_create_inode()
630 error = create_ok(dip, name, mode); in gfs2_create_inode()
679 munge_mode_uid_gid(dip, inode); in gfs2_create_inode()
680 check_and_update_goal(dip); in gfs2_create_inode()
681 ip->i_goal = dip->i_goal; in gfs2_create_inode()
691 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) || in gfs2_create_inode()
697 ip->i_diskflags |= (dip->i_diskflags & GFS2_DIF_INHERIT_JDATA); in gfs2_create_inode()
704 if (dip->i_diskflags & GFS2_DIF_SYSTEM) in gfs2_create_inode()
709 if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) || in gfs2_create_inode()
710 (dip->i_diskflags & GFS2_DIF_TOPDIR)) in gfs2_create_inode()
746 init_dinode(dip, ip, symname); in gfs2_create_inode()
776 error = security_inode_init_security(&ip->i_inode, &dip->i_inode, name, in gfs2_create_inode()
781 error = link_dinode(dip, name, ip, &da); in gfs2_create_inode()
798 gfs2_qa_put(dip); in gfs2_create_inode()
833 gfs2_qa_put(dip); in gfs2_create_inode()
923 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_link() local
935 error = gfs2_qa_get(dip); in gfs2_link()
939 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); in gfs2_link()
969 if (!dip->i_inode.i_nlink) in gfs2_link()
972 if (dip->i_entries == (u32)-1) in gfs2_link()
990 error = gfs2_quota_lock_check(dip, &ap); in gfs2_link()
994 error = gfs2_inplace_reserve(dip, &ap); in gfs2_link()
998 error = gfs2_trans_begin(sdp, gfs2_trans_da_blks(dip, &da, 2), 0); in gfs2_link()
1028 gfs2_inplace_release(dip); in gfs2_link()
1031 gfs2_quota_unlock(dip); in gfs2_link()
1038 gfs2_qa_put(dip); in gfs2_link()
1055 static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, in gfs2_unlink_ok() argument
1063 if ((dip->i_inode.i_mode & S_ISVTX) && in gfs2_unlink_ok()
1064 !uid_eq(dip->i_inode.i_uid, current_fsuid()) && in gfs2_unlink_ok()
1068 if (IS_APPEND(&dip->i_inode)) in gfs2_unlink_ok()
1071 error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); in gfs2_unlink_ok()
1075 return gfs2_dir_check(&dip->i_inode, name, ip); in gfs2_unlink_ok()
1090 static int gfs2_unlink_inode(struct gfs2_inode *dip, in gfs2_unlink_inode() argument
1097 error = gfs2_dir_del(dip, dentry); in gfs2_unlink_inode()
1127 struct gfs2_inode *dip = GFS2_I(dir); in gfs2_unlink() local
1141 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); in gfs2_unlink()
1173 error = gfs2_unlink_ok(dip, &dentry->d_name, ip); in gfs2_unlink()
1181 error = gfs2_unlink_inode(dip, dentry); in gfs2_unlink()